SlideShare uma empresa Scribd logo
1 de 36
Baixar para ler offline
Observing Your App and
                       Everything Else It Runs On Using
                       DTrace
                                 session code S308357




  Angelo Rajadurai
  Sr. Technology Evangelist – Sun Microsystems Inc.

Sunday, May 31, 2009
goal




                Learn how to Dynamically observe your
                    application and its environment.




                                2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone



Sunday, May 31, 2009
your app...


                             Application Logic
                                                                                 ruby
                         Frameworks
                                                                               python
                         Presentation                                            php




                                                                                                             C++
                                                                                                              C
                 JSP/Javascript/Ajax/JavaFX
                                                                                  perl
                Container Glassfish/J2EE                                        shell
                                                                                java
                       Database                                           Apps run                            Native
                                                                           in VM                              Apps
               MySQL/Oracle/Postgres

                       Operating System Solaris/Linux/OS X/Windows
                                              2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   3



Sunday, May 31, 2009
on the menu today

                            Our Setup
                                  Drupal 6.12


                                  Apache 2.2
                              PHP - Zend 5.2

                              MySQL 5.1.30
                                  Amp Stack


                           OpenSolaris 2009.06
                                                                                                                     4




                                       2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone



Sunday, May 31, 2009
one small easy step


       the AMP stack
       To build, install, integrate, performance tune and deploy
         the amp stack on opensolaris...

                            # pkg install amp-dev




                                      2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   5



Sunday, May 31, 2009
one slide on Drupal




                                    2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   6



Sunday, May 31, 2009
questions questions questions

                                              How much time am I
                                               spending in Apache/
     How much of my load is                       MySQL/PHP?
      from anonymous users



                                                                            What are the Drupal
                                                                            modules that take up
                                                                               the most time?


  What type of database
     load is caused by
    anonymous users                                                            What are the most
                                                                               expensive hooks in a
                                                                               given Drupal module?




                                     2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   7



Sunday, May 31, 2009
the big game hunt

                                                                        “M
                                                                             ay
                                            m in”                                     Da
                                                                                   be ta
                                         d
                                  r: e a                                              th bas
                                pe as
                              lo b
                                                                                         e
                                                                                    w i m Ad
                                                                                              e
                          ve ata                                                       ll idd mi
                        De d                                                             kn le n:
                                                                                           o w wa
                            e
                         th                                                                   ”  re
                       k                                                                                                 gu
                     as                                                                                                      ys
              “I’d




                  “I                                                                                  :
                       do   S
                        n’t ysa                                                                   e rt in”
                                                                                                xp adm
                       De kno dmi                                                             E
                                                                                             e ys
                         ve w! n                                                           ar e S
                           lop A
                              e r sk                                                  d lew th
                                 ”   th                                            id sk
                                        e                                        M a
                                                                                       s
                                                                                    et
                                                                                 “L
                                                    2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   8



Sunday, May 31, 2009
the vicious cycle




                            Restart
            Stop App                                          Add Code                                Compile
                            w/ flags



         Prebuilt Instruments                             Custom Instruments



                       Instrument      Validate

                                                                                Run in
                                                                              production

                        Process       Collect info


                                      2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   9



Sunday, May 31, 2009
oh please



            Please let me
            observe a live
            system.




                             2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   10



Sunday, May 31, 2009
dynamic tracing



                          Application Logic
                        Frameworks                                        c
                       Presentation                                      c++
               12::SELECT id, name, symbol, conversion_rate FROM currencies WHERE
                   JSP/Javascript/Ajax
               status = 'Active' and deleted = 0
               12::SELECT category, name, value FROM config
                                                                          ph




                                                                                                     pytho
               12::SELECT id FROM outbound_email WHERE type = 'system'




                                                                                                                    rub
             Container          Glassfish/Tomcat
                                                                        perl
                       Database                                         shell
                                                                                      Native
                       Operating System Solaris/Linux/OS X/
                                               2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   11



Sunday, May 31, 2009
dynamic tracing



                          Application Logic
               -> contentAreaClick
                    -> getPreventDefault


                                                                      c
                    <- getPreventDefault

                        Frameworks
               <- contentAreaClick



                       Presentation                                  c++
                   JSP/Javascript/Ajax
                                                                      ph




                                                                                                pytho
                                                                                                               rub
             Container          Glassfish/Tomcat
                                                                    perl
                       Database                                     shell
                                                                                 Native
                       Operating System Solaris/Linux/OS X/
                                           2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   12



Sunday, May 31, 2009
You can do it with...




                         DTrace




                                2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   13



Sunday, May 31, 2009
poll




                 Have you heard about it

            Have you used it

     Have you written d-scripts




                                      2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   14



Sunday, May 31, 2009
The D - Language

                               Basics
                                 of
                       Dynamic Instrumentation




                          2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   15



Sunday, May 31, 2009
instrumentation format

                                           d-script
      probe
           provider    :   module   :   probe   :        name                                                       where

       /                     predicate                                   /                                           when
       {

                               actions                                                                           do what

       }

                                                2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   16



Sunday, May 31, 2009
command line version

                              dtrace command line




                       # dtrace -n probe’/predicate/{action}’




                                         2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   17



Sunday, May 31, 2009
demo




                       2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   18



Sunday, May 31, 2009
aggregation

             dtrace -P syscall
              => mmap             mmap
               5 <= mmap               mmap
               5 => munmap              munmap
               5 <= munmap              munmap
               5 => setcontext         setcontext
               5 <= setcontext         setcontext
               5 => getrlimit        getrlimit
               5 <= getrlimit        getrlimit
               5 => getpid           getpid
               5 <= getpid           getpid
               5 => setcontext         setcontext
               5 <= setcontext         setcontext
               5 => sysi86           sysi86
               5 <= sysi86           sysi86
               5 => brk            brk
               5 <= brk            brk
               5 => brk            brk
               5 <= brk            brk
               5 => xstat           xstat
               5 <= xstat           xstat
               5 => resolvepath         resolvepath
               5 <= resolvepath         resolvepath
               5 => open             open
               5 <= open
               5 => mmap
                                     open
                                       mmap                                        rexit                                 1
               5 <= mmap
               5 => mmap
                                       mmap
                                       mmap                                        fcntl                                 2
                                                                                   fsat                                  2
               5 <= mmap               mmap
               5 => mmap               mmap
               5 <= mmap               mmap
               5 => mmap
               5 <= mmap
                                       mmap
                                       mmap                                        getpid                                2
               5 => munmap
               5 <= munmap
                                        munmap
                                        munmap                                     getrlimit                             2
                                                                                   sysi86                                2
               5 => memcntl            memcntl
               5 <= memcntl            memcntl
               5 => close           close
               5 <= close
               5 => xstat
                                    close
                                    xstat                                          write                                 2
                                                                                   fstat64                               4
               5 <= xstat           xstat
               5 => resolvepath         resolvepath
               5 <= resolvepath         resolvepath
               5 => open
               5 <= open
                                     open
                                     open                                          getdents64                            4
               5 => mmap
               5 <= mmap
                                       mmap
                                       mmap                                        memcntl                               4
                                                                                   open                                  4
               5 => mmap               mmap
               5 <= mmap               mmap
               5 => mmap               mmap
               5 <= mmap
               5 => mmap
                                       mmap
                                       mmap                                        resolvepath                          4
               5 <= mmap
               5 => mmap
               5 <= mmap
                                       mmap
                                       mmap
                                       mmap
                                                                                   setcontext                           4
               5 => munmap
               5 <= munmap
                                        munmap
                                        munmap                                           xstat                          4
               5 => memcntl
               5 <= memcntl
               5 => close
                                       memcntl
                                       memcntl
                                    close
                                                                                         ioctl                          6
               5 <= close
               5 => munmap
                                    close
                                        munmap                                     brk                                  8
               5 <= munmap
               5 => ioctl         ioctl
                                        munmap
                                                                                   munmap                               8
                                                                                   close                               10
               5 <= ioctl         ioctl
               5 => ioctl         ioctl
               5 <= ioctl         ioctl
               5 => brk
               5 <= brk
               5 => brk
                                   brk
                                   brk
                                   brk
                                                                                   mmap                                20
               5 <= brk            brk
               5 => fsat           fsat
               5 <= fsat           fsat
               5 => fcntl          fcntl
               5 <= fcntl          fcntl
               5 => fstat64          fstat64
               5 <= fstat64          fstat64
               5 => getdents64          getdents64
               5 <= getdents64          getdents64
               5 => getdents64          getdents64


                                                                  dtrace -P syscall’{@=count(probefunc)}’
               5 <= getdents64          getdents64
               5 => close           close
               5 <= close           close
               5 => ioctl         ioctl
               5 <= ioctl         ioctl
               5 => fstat64          fstat64
               5 <= fstat64          fstat64
               5 => write           write
               5 <= write           write
               5 => close           close
               5 <= close           close
               5 => close           close
               5 <= close           close
               5 => rexit          rexit




                                                      2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   19



Sunday, May 31, 2009
dtrace aggregates - demo




                                        2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   20



Sunday, May 31, 2009
the pid provider


                                    •   Dynamically create probes in
        provider: pid$<processId>         live running applications.
        module: name of library
        probe:    function name
                                    •   No extra work needed from
        name:     entry                   application developer
                  return
                  offset
                                    •   Available without any compile
                                          or runtime flags
                                    •   Can be created on optimized
            Pr




                                          binaries as well
                 Pi id
                  ov




                                    •   Probes created at function
                   d er




                                          boundaries and offset

                                         2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   21



Sunday, May 31, 2009
demo




                       2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   22



Sunday, May 31, 2009
probing MySQL using Pid


    provider: pid$<mysql-pid>
    module: not-used
    probe:*dispatch_command*    #!/usr/sbin/dtrace -qs
    name:        entry
      arg2 - SQL command        pid$1::*dispatch_command*:entry
                                {
                                  printf("%sn",copyinstr(arg2,arg3));
                                }
        M ue
         Q
         yS ri
           Q es
             L




                                        2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   23



Sunday, May 31, 2009
dtrace and mysql - demo




                                       2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   24



Sunday, May 31, 2009
php provider
                                  New and improved in OpenSolaris 2009.06
                                          compile-file-entry/-return
                                             function-entry/-return
      provider: php$<pid>
      module: not-used                      execution-entry/-return
      probe:           not-used            exception-thrown/-catched
      name:            <see detail ->
                                                      error
                                           request-startup/-shutdown
         Ap ov
          Pr




                                                                  Older releases
           ac id
             he er




                                              function-entry/-return
                                            2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   25



Sunday, May 31, 2009
dtrace and php - demo




                                     2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   26



Sunday, May 31, 2009
Apache provider


                                             received-request
      provider: apache$<pid>
      module: not-used                          log-request
      probe:           not-used
      name:            <see detail ->          create-child
                                            accept-connection
                                         check-user-credentials
                                               check-access
         Ap ov
          Pr




                                           check-authorization
           ac id
             he er




                                        2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   27



Sunday, May 31, 2009
gotcha




                        2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   28



Sunday, May 31, 2009
dtrace and the webstack




                                       2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   29



Sunday, May 31, 2009
Observing the entire stack
       More details on the scripts we saw earlier...

       what are the hot modules in Drupal?

       what are the hot hooks in Drupal?

       how much of my Drupal load is from anonymous users

       how much time am I spending in Apache/MySQL/PHP?

       what are the SQL statements that are executed by anon
         users
                                   2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   30



Sunday, May 31, 2009
Give me more!
       DTrace landing page:
            http://www.opensolaris.org/os/community/dtrace

       DTrace Toolkit:
         In OpenSolaris - /opt/DTT
         Solaris download -
            http://www.opensolaris.org/os/community/dtrace/dtracetoolkit/


       DTrace Bigadmin page:
            http://www.sun.com/bigadmin/content/dtrace/

       Lots and lots of info on the web - Google “dtrace”


                                         2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   31



Sunday, May 31, 2009
Social
       My Blog:
         http://blogs.sun.com/angelo


       Twitter:
         rajadurai

       DTrace hands on lab
         http://developers.sun.com/learning/javaoneonline/j1lab.jsp?
         lab=LAB-9400&yr=2008&track=1




                                       2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   32



Sunday, May 31, 2009
Observing Your App and
                       Everything Else It Runs On Using
                       DTrace
                             session code S308357




  Angelo Rajadurai
  angelo.rajadurai@sun.com

Sunday, May 31, 2009
DTrace and JavaScript




                                     2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   34



Sunday, May 31, 2009
Observing javascript using the javascript provider

       Enter script details




                               2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   35



Sunday, May 31, 2009
implementation




                              2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone   36



Sunday, May 31, 2009

Mais conteúdo relacionado

Mais procurados

Mais procurados (11)

A Puppet Story
A Puppet StoryA Puppet Story
A Puppet Story
 
Learn C Programming Language by Using GDB
Learn C Programming Language by Using GDBLearn C Programming Language by Using GDB
Learn C Programming Language by Using GDB
 
Nachos
NachosNachos
Nachos
 
Robotlegs 2 and your brain
Robotlegs 2 and your brainRobotlegs 2 and your brain
Robotlegs 2 and your brain
 
Android Optimization: Myth and Reality
Android Optimization: Myth and RealityAndroid Optimization: Myth and Reality
Android Optimization: Myth and Reality
 
Explore Android Internals
Explore Android InternalsExplore Android Internals
Explore Android Internals
 
Diagnosing Your Application on the JVM
Diagnosing Your Application on the JVMDiagnosing Your Application on the JVM
Diagnosing Your Application on the JVM
 
Jdk Tools For Performance Diagnostics
Jdk Tools For Performance DiagnosticsJdk Tools For Performance Diagnostics
Jdk Tools For Performance Diagnostics
 
Develop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM BoardsDevelop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM Boards
 
Shorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation SystemsShorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation Systems
 
Java Tools and Techniques for Solving Tricky Problem
Java Tools and Techniques for Solving Tricky ProblemJava Tools and Techniques for Solving Tricky Problem
Java Tools and Techniques for Solving Tricky Problem
 

Semelhante a Observing Your App and Everything Else Using DTrace

Karonis Rom Telecom
Karonis Rom TelecomKaronis Rom Telecom
Karonis Rom Telecomknowhowgr
 
XML Amsterdam 2012 Keynote
XML Amsterdam 2012 KeynoteXML Amsterdam 2012 Keynote
XML Amsterdam 2012 Keynotejimfuller2009
 
Java magazine jan feb 2018
Java magazine jan feb 2018Java magazine jan feb 2018
Java magazine jan feb 2018Acacio Martins
 
Eclipse Packaging Project Usage Data Collector
Eclipse Packaging Project Usage Data CollectorEclipse Packaging Project Usage Data Collector
Eclipse Packaging Project Usage Data CollectorMarkus Knauer
 
Jazoon12: Tracing Requirements with the Eclipse Requirements Modeling Framework
Jazoon12: Tracing Requirements with the Eclipse Requirements Modeling FrameworkJazoon12: Tracing Requirements with the Eclipse Requirements Modeling Framework
Jazoon12: Tracing Requirements with the Eclipse Requirements Modeling Frameworkjastram
 
The Forces Driving Java
The Forces Driving JavaThe Forces Driving Java
The Forces Driving JavaSteve Elliott
 
SOLID Principles of Refactoring Presentation - Inland Empire User Group
SOLID Principles of Refactoring Presentation - Inland Empire User GroupSOLID Principles of Refactoring Presentation - Inland Empire User Group
SOLID Principles of Refactoring Presentation - Inland Empire User GroupAdnan Masood
 
Sulthan's_JAVA_Material_for_B.Sc-CS.pdf
Sulthan's_JAVA_Material_for_B.Sc-CS.pdfSulthan's_JAVA_Material_for_B.Sc-CS.pdf
Sulthan's_JAVA_Material_for_B.Sc-CS.pdfSULTHAN BASHA
 
Bay Area Drupal Camp Efficiency
Bay Area Drupal Camp EfficiencyBay Area Drupal Camp Efficiency
Bay Area Drupal Camp Efficiencysmattoon
 
Java Magazine March April 2019
Java Magazine March April 2019Java Magazine March April 2019
Java Magazine March April 2019Erik Gur
 
OWASP Poland Day 2018 - Andrzej Dyjak - Zero Trust Theorem
OWASP Poland Day 2018 - Andrzej Dyjak - Zero Trust TheoremOWASP Poland Day 2018 - Andrzej Dyjak - Zero Trust Theorem
OWASP Poland Day 2018 - Andrzej Dyjak - Zero Trust TheoremOWASP
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller ColumnsJonathan Fine
 
MvvmCross Seminar
MvvmCross SeminarMvvmCross Seminar
MvvmCross SeminarXamarin
 
MvvmCross Introduction
MvvmCross IntroductionMvvmCross Introduction
MvvmCross IntroductionStuart Lodge
 
JAVA INTRODUCTION
JAVA INTRODUCTIONJAVA INTRODUCTION
JAVA INTRODUCTIONProf Ansari
 
JAVA INTRODUCTION
JAVA INTRODUCTIONJAVA INTRODUCTION
JAVA INTRODUCTIONProf Ansari
 
EclipseCon 2016 - OCCIware : one Cloud API to rule them all
EclipseCon 2016 - OCCIware : one Cloud API to rule them allEclipseCon 2016 - OCCIware : one Cloud API to rule them all
EclipseCon 2016 - OCCIware : one Cloud API to rule them allMarc Dutoo
 
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open Wide
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open WideOCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open Wide
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open WideOCCIware
 
Six Principles of Software Design to Empower Scientists
Six Principles of Software Design to Empower ScientistsSix Principles of Software Design to Empower Scientists
Six Principles of Software Design to Empower ScientistsDavid De Roure
 
Creating Cloud Communities
Creating Cloud CommunitiesCreating Cloud Communities
Creating Cloud CommunitiesPeter Coffee
 

Semelhante a Observing Your App and Everything Else Using DTrace (20)

Karonis Rom Telecom
Karonis Rom TelecomKaronis Rom Telecom
Karonis Rom Telecom
 
XML Amsterdam 2012 Keynote
XML Amsterdam 2012 KeynoteXML Amsterdam 2012 Keynote
XML Amsterdam 2012 Keynote
 
Java magazine jan feb 2018
Java magazine jan feb 2018Java magazine jan feb 2018
Java magazine jan feb 2018
 
Eclipse Packaging Project Usage Data Collector
Eclipse Packaging Project Usage Data CollectorEclipse Packaging Project Usage Data Collector
Eclipse Packaging Project Usage Data Collector
 
Jazoon12: Tracing Requirements with the Eclipse Requirements Modeling Framework
Jazoon12: Tracing Requirements with the Eclipse Requirements Modeling FrameworkJazoon12: Tracing Requirements with the Eclipse Requirements Modeling Framework
Jazoon12: Tracing Requirements with the Eclipse Requirements Modeling Framework
 
The Forces Driving Java
The Forces Driving JavaThe Forces Driving Java
The Forces Driving Java
 
SOLID Principles of Refactoring Presentation - Inland Empire User Group
SOLID Principles of Refactoring Presentation - Inland Empire User GroupSOLID Principles of Refactoring Presentation - Inland Empire User Group
SOLID Principles of Refactoring Presentation - Inland Empire User Group
 
Sulthan's_JAVA_Material_for_B.Sc-CS.pdf
Sulthan's_JAVA_Material_for_B.Sc-CS.pdfSulthan's_JAVA_Material_for_B.Sc-CS.pdf
Sulthan's_JAVA_Material_for_B.Sc-CS.pdf
 
Bay Area Drupal Camp Efficiency
Bay Area Drupal Camp EfficiencyBay Area Drupal Camp Efficiency
Bay Area Drupal Camp Efficiency
 
Java Magazine March April 2019
Java Magazine March April 2019Java Magazine March April 2019
Java Magazine March April 2019
 
OWASP Poland Day 2018 - Andrzej Dyjak - Zero Trust Theorem
OWASP Poland Day 2018 - Andrzej Dyjak - Zero Trust TheoremOWASP Poland Day 2018 - Andrzej Dyjak - Zero Trust Theorem
OWASP Poland Day 2018 - Andrzej Dyjak - Zero Trust Theorem
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller Columns
 
MvvmCross Seminar
MvvmCross SeminarMvvmCross Seminar
MvvmCross Seminar
 
MvvmCross Introduction
MvvmCross IntroductionMvvmCross Introduction
MvvmCross Introduction
 
JAVA INTRODUCTION
JAVA INTRODUCTIONJAVA INTRODUCTION
JAVA INTRODUCTION
 
JAVA INTRODUCTION
JAVA INTRODUCTIONJAVA INTRODUCTION
JAVA INTRODUCTION
 
EclipseCon 2016 - OCCIware : one Cloud API to rule them all
EclipseCon 2016 - OCCIware : one Cloud API to rule them allEclipseCon 2016 - OCCIware : one Cloud API to rule them all
EclipseCon 2016 - OCCIware : one Cloud API to rule them all
 
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open Wide
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open WideOCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open Wide
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open Wide
 
Six Principles of Software Design to Empower Scientists
Six Principles of Software Design to Empower ScientistsSix Principles of Software Design to Empower Scientists
Six Principles of Software Design to Empower Scientists
 
Creating Cloud Communities
Creating Cloud CommunitiesCreating Cloud Communities
Creating Cloud Communities
 

Último

Français Patch Tuesday - Avril
Français Patch Tuesday - AvrilFrançais Patch Tuesday - Avril
Français Patch Tuesday - AvrilIvanti
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...amber724300
 
WomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneWomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneUiPathCommunity
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Karmanjay Verma
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialJoão Esperancinha
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...BookNet Canada
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsYoss Cohen
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 

Último (20)

Français Patch Tuesday - Avril
Français Patch Tuesday - AvrilFrançais Patch Tuesday - Avril
Français Patch Tuesday - Avril
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
 
WomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneWomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyone
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorial
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platforms
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 

Observing Your App and Everything Else Using DTrace

  • 1. Observing Your App and Everything Else It Runs On Using DTrace session code S308357 Angelo Rajadurai Sr. Technology Evangelist – Sun Microsystems Inc. Sunday, May 31, 2009
  • 2. goal Learn how to Dynamically observe your application and its environment. 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone Sunday, May 31, 2009
  • 3. your app... Application Logic ruby Frameworks python Presentation php C++ C JSP/Javascript/Ajax/JavaFX perl Container Glassfish/J2EE shell java Database Apps run Native in VM Apps MySQL/Oracle/Postgres Operating System Solaris/Linux/OS X/Windows 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 3 Sunday, May 31, 2009
  • 4. on the menu today Our Setup Drupal 6.12 Apache 2.2 PHP - Zend 5.2 MySQL 5.1.30 Amp Stack OpenSolaris 2009.06 4 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone Sunday, May 31, 2009
  • 5. one small easy step the AMP stack To build, install, integrate, performance tune and deploy the amp stack on opensolaris... # pkg install amp-dev 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 5 Sunday, May 31, 2009
  • 6. one slide on Drupal 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 6 Sunday, May 31, 2009
  • 7. questions questions questions How much time am I spending in Apache/ How much of my load is MySQL/PHP? from anonymous users What are the Drupal modules that take up the most time? What type of database load is caused by anonymous users What are the most expensive hooks in a given Drupal module? 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 7 Sunday, May 31, 2009
  • 8. the big game hunt “M ay m in” Da be ta d r: e a th bas pe as lo b e w i m Ad e ve ata ll idd mi De d kn le n: o w wa e th ” re k gu as ys “I’d “I : do S n’t ysa e rt in” xp adm De kno dmi E e ys ve w! n ar e S lop A e r sk d lew th ” th id sk e M a s et “L 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 8 Sunday, May 31, 2009
  • 9. the vicious cycle Restart Stop App Add Code Compile w/ flags Prebuilt Instruments Custom Instruments Instrument Validate Run in production Process Collect info 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 9 Sunday, May 31, 2009
  • 10. oh please Please let me observe a live system. 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 10 Sunday, May 31, 2009
  • 11. dynamic tracing Application Logic Frameworks c Presentation c++ 12::SELECT id, name, symbol, conversion_rate FROM currencies WHERE JSP/Javascript/Ajax status = 'Active' and deleted = 0 12::SELECT category, name, value FROM config ph pytho 12::SELECT id FROM outbound_email WHERE type = 'system' rub Container Glassfish/Tomcat perl Database shell Native Operating System Solaris/Linux/OS X/ 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 11 Sunday, May 31, 2009
  • 12. dynamic tracing Application Logic -> contentAreaClick -> getPreventDefault c <- getPreventDefault Frameworks <- contentAreaClick Presentation c++ JSP/Javascript/Ajax ph pytho rub Container Glassfish/Tomcat perl Database shell Native Operating System Solaris/Linux/OS X/ 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 12 Sunday, May 31, 2009
  • 13. You can do it with... DTrace 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 13 Sunday, May 31, 2009
  • 14. poll Have you heard about it Have you used it Have you written d-scripts 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 14 Sunday, May 31, 2009
  • 15. The D - Language Basics of Dynamic Instrumentation 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 15 Sunday, May 31, 2009
  • 16. instrumentation format d-script probe provider : module : probe : name where / predicate / when { actions do what } 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 16 Sunday, May 31, 2009
  • 17. command line version dtrace command line # dtrace -n probe’/predicate/{action}’ 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 17 Sunday, May 31, 2009
  • 18. demo 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 18 Sunday, May 31, 2009
  • 19. aggregation dtrace -P syscall => mmap mmap 5 <= mmap mmap 5 => munmap munmap 5 <= munmap munmap 5 => setcontext setcontext 5 <= setcontext setcontext 5 => getrlimit getrlimit 5 <= getrlimit getrlimit 5 => getpid getpid 5 <= getpid getpid 5 => setcontext setcontext 5 <= setcontext setcontext 5 => sysi86 sysi86 5 <= sysi86 sysi86 5 => brk brk 5 <= brk brk 5 => brk brk 5 <= brk brk 5 => xstat xstat 5 <= xstat xstat 5 => resolvepath resolvepath 5 <= resolvepath resolvepath 5 => open open 5 <= open 5 => mmap open mmap rexit 1 5 <= mmap 5 => mmap mmap mmap fcntl 2 fsat 2 5 <= mmap mmap 5 => mmap mmap 5 <= mmap mmap 5 => mmap 5 <= mmap mmap mmap getpid 2 5 => munmap 5 <= munmap munmap munmap getrlimit 2 sysi86 2 5 => memcntl memcntl 5 <= memcntl memcntl 5 => close close 5 <= close 5 => xstat close xstat write 2 fstat64 4 5 <= xstat xstat 5 => resolvepath resolvepath 5 <= resolvepath resolvepath 5 => open 5 <= open open open getdents64 4 5 => mmap 5 <= mmap mmap mmap memcntl 4 open 4 5 => mmap mmap 5 <= mmap mmap 5 => mmap mmap 5 <= mmap 5 => mmap mmap mmap resolvepath 4 5 <= mmap 5 => mmap 5 <= mmap mmap mmap mmap setcontext 4 5 => munmap 5 <= munmap munmap munmap xstat 4 5 => memcntl 5 <= memcntl 5 => close memcntl memcntl close ioctl 6 5 <= close 5 => munmap close munmap brk 8 5 <= munmap 5 => ioctl ioctl munmap munmap 8 close 10 5 <= ioctl ioctl 5 => ioctl ioctl 5 <= ioctl ioctl 5 => brk 5 <= brk 5 => brk brk brk brk mmap 20 5 <= brk brk 5 => fsat fsat 5 <= fsat fsat 5 => fcntl fcntl 5 <= fcntl fcntl 5 => fstat64 fstat64 5 <= fstat64 fstat64 5 => getdents64 getdents64 5 <= getdents64 getdents64 5 => getdents64 getdents64 dtrace -P syscall’{@=count(probefunc)}’ 5 <= getdents64 getdents64 5 => close close 5 <= close close 5 => ioctl ioctl 5 <= ioctl ioctl 5 => fstat64 fstat64 5 <= fstat64 fstat64 5 => write write 5 <= write write 5 => close close 5 <= close close 5 => close close 5 <= close close 5 => rexit rexit 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 19 Sunday, May 31, 2009
  • 20. dtrace aggregates - demo 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 20 Sunday, May 31, 2009
  • 21. the pid provider • Dynamically create probes in provider: pid$<processId> live running applications. module: name of library probe: function name • No extra work needed from name: entry application developer return offset • Available without any compile or runtime flags • Can be created on optimized Pr binaries as well Pi id ov • Probes created at function d er boundaries and offset 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 21 Sunday, May 31, 2009
  • 22. demo 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 22 Sunday, May 31, 2009
  • 23. probing MySQL using Pid provider: pid$<mysql-pid> module: not-used probe:*dispatch_command* #!/usr/sbin/dtrace -qs name: entry arg2 - SQL command pid$1::*dispatch_command*:entry { printf("%sn",copyinstr(arg2,arg3)); } M ue Q yS ri Q es L 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 23 Sunday, May 31, 2009
  • 24. dtrace and mysql - demo 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 24 Sunday, May 31, 2009
  • 25. php provider New and improved in OpenSolaris 2009.06 compile-file-entry/-return function-entry/-return provider: php$<pid> module: not-used execution-entry/-return probe: not-used exception-thrown/-catched name: <see detail -> error request-startup/-shutdown Ap ov Pr Older releases ac id he er function-entry/-return 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 25 Sunday, May 31, 2009
  • 26. dtrace and php - demo 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 26 Sunday, May 31, 2009
  • 27. Apache provider received-request provider: apache$<pid> module: not-used log-request probe: not-used name: <see detail -> create-child accept-connection check-user-credentials check-access Ap ov Pr check-authorization ac id he er 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 27 Sunday, May 31, 2009
  • 28. gotcha 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 28 Sunday, May 31, 2009
  • 29. dtrace and the webstack 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 29 Sunday, May 31, 2009
  • 30. Observing the entire stack More details on the scripts we saw earlier... what are the hot modules in Drupal? what are the hot hooks in Drupal? how much of my Drupal load is from anonymous users how much time am I spending in Apache/MySQL/PHP? what are the SQL statements that are executed by anon users 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 30 Sunday, May 31, 2009
  • 31. Give me more! DTrace landing page: http://www.opensolaris.org/os/community/dtrace DTrace Toolkit: In OpenSolaris - /opt/DTT Solaris download - http://www.opensolaris.org/os/community/dtrace/dtracetoolkit/ DTrace Bigadmin page: http://www.sun.com/bigadmin/content/dtrace/ Lots and lots of info on the web - Google “dtrace” 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 31 Sunday, May 31, 2009
  • 32. Social My Blog: http://blogs.sun.com/angelo Twitter: rajadurai DTrace hands on lab http://developers.sun.com/learning/javaoneonline/j1lab.jsp? lab=LAB-9400&yr=2008&track=1 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 32 Sunday, May 31, 2009
  • 33. Observing Your App and Everything Else It Runs On Using DTrace session code S308357 Angelo Rajadurai angelo.rajadurai@sun.com Sunday, May 31, 2009
  • 34. DTrace and JavaScript 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 34 Sunday, May 31, 2009
  • 35. Observing javascript using the javascript provider Enter script details 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 35 Sunday, May 31, 2009
  • 36. implementation 2009 CommunityOne Conference: EAST | developers.sun.com/events/communityone 36 Sunday, May 31, 2009