SlideShare una empresa de Scribd logo
1 de 29
Descargar para leer sin conexión
DTRACE
Overview
Jérôme Gauthier
May 2011


                  COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
AGENDA


1. Context
2. DTrace Framework
3. System inspection and analysis
4. DTrace Toolkit
5. Demo


                                              2
                    COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
Context


DTrace Framework


System inspection and analysis


DTrace Toolkit


Demo

                                             3
                   COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
CONTEXT

    We need tools to debug and observe different situations …



                                                              Understand the
     Analyze the system
                                                            system utilization or
        performance
                                                                 saturation




          Debug an                                               Debug a
          application                                       system/kernel crash


                                                4
                      COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
CONTEXT
                                          … in several areas

                  pkill                       pargs                             pflags             truss          mdb
 pgrep                        pstop

              Process                             Process                                                   Process
              control                            statistics                                                debugging



              System                              Kernel                                                     Kernel
             statistics                          statistics                                                debugging
   vmstat                                                                                       lockstat
                 iostat             cpustat                           kstat                                      kmdb


Examples of some Solaris commands


                                                                  5
                                        COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
CONTEXT

• Some existing utilities are process based
• Some are only inspecting certain parts of the system
    • Disks
    • Virtual memory
    • Network
    • Kernel



               Need a tool to simplify the analysis of all parts of a system

               This tool must not make the system any slower



                                                        6
                              COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
Context


DTrace Framework


System inspection and analysis


DTrace Toolkit


Demo

                                             7
                   COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
DTRACE FRAMEWORK

• DTrace : A facility for dynamic instrumentation of production systems
      Another way to debug and observe the entire system and understand
     the big picture


• Open source (CDDL = Common Development and Distribution
  License)


• Supported platforms : Unix-like systems :




                                                      8
                            COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
DTRACE FRAMEWORK

                                        User level



            Operating System             DTRACE                                    Programs


                                      Kernel level


• Examine how the system works
• Track down performance problems across many layers of software
• Locate the cause of aberrant behavior


           Does not replace or retire other system utilities

                                                     9
                           COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
DTRACE FRAMEWORK

• A framework for real-time analysis and observation


• Designed for live production systems
      A totally safe way to inspect live data on production systems
      No need to stop or restart applications
      Live measurement and interpretation


• Over 30 000 data monitoring points spread in all system


• Zero effect when disabled, safe and no system slowdown when enabled


                                                    10
                           COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
DTRACE FRAMEWORK

• Everything about DTrace is virtualized per consumer
      There is no limit on the number of concurrent DTrace consumers


• Possibility to create custom programs to dynamically instrument the
  system


• Example of problems that can be detected and analyzed:
      High CPU utilization
      Acute memory pressure
      Abnormal I/O activity
      Excessive network traffic

                                                       11
                              COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
Context


DTrace Framework


System inspection and analysis


DTrace Toolkit


Demo

                                            12
                   COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
SYSTEM INSPECTION AND ANALYSIS
PROBES

• Probes are programmable sensors placed all over the system


• A probe fires when the event happens
      Then, certain actions are executed only if the predicate expression
     is true


• General form of a probe clause :
                                                                         probe description
                                                                         /predicate/
                                                                         {
                                                                            actions
                                                                         }
                                                     13
                            COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
probe description
SYSTEM INSPECTION AND ANALYSIS
                                                                                    /predicate/
PROBES                                                                              {
                                                                                         actions
                                                                                    }
• A predicate allow action to only be taken when certain
  conditions are met
        Example : Look only for a process which has the pid=1203
                   Match a process which has the name firefox-bin


• An action can be “ record a stack trace, a timestamp, or the argument to
  a function ”


• When some probes fire, DTrace gathers the data and reports it back to
  you
      If no action specified, DTrace will just take note of each time the
     probe fires

                                                     14
                            COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
SYSTEM INSPECTION AND ANALYSIS
PROBES

• Actions are used to record data to a DTrace buffer
• Different types of actions:

     Type of actions       Example                                                      Explanation
                          trace()                  Records the result of trace to the buffer
Data recording
                          printf()                 Traces a D expression
                          stack()                  Records a kernel stack trace
                          stop()                   Stops the process which has executed the probe
Destructive
                          raise()                  Signal a process at a precise point during execution
                          panic()                  Force a crash dump
                          exit()                   Stop tracing and exits
Special
                          copyin()                 Creates a buffer and returns its address
                          strlen()                 Returns the length of a string in bytes


                                                         15
                                COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
probe description
SYSTEM INSPECTION AND ANALYSIS
                                                                                              /predicate/
PROBES                                                                                        {
                                                                                                   actions
                                                                                              }
• Each probe is uniquely identified by a 4-tuple :

 < provider, module, function, name >                                                 Probe description


                  The name of the module in which the probe is located
Module              Either the name of a kernel module or the name of a user library

                   If this probe correspond to a specific program location, it’s the name
Function           of the program function in which the probe is located.

                   The final component of the tuple is the string name of the probe that
Name               give you some idea of the probe’s semantic meaning.


• Some probes does not have a module and function (e.g. : BEGIN, END)
      We can identify a probe only by its name
                                                       16
                              COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
SYSTEM INSPECTION AND ANALYSIS
PROVIDERS

                  < provider, module, function, name >



• DTrace probes come from a set of kernel modules called providers
      Which correspond to a particular kind of instrumentation


• We can list the probes that a provider can transmit to the DTrace
  Framework


• A provider pass the control to DTrace when you decide to enable one of
  its probes


                                                     17
                            COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
SYSTEM INSPECTION AND ANALYSIS
PROVIDERS

• Example of some providers :


         SYSCALL                                  PROC                                         SCHED
  • Holds the entire           • Handle process creation                               • CPU scheduling: sleeping,
  communication from           and termination                                         running threads
  userland to kernel space     • Sending and handling                                  • CPU time: which threads
  • Every system call on the   signals                                                 are run by which CPU and
  system                                                                               for how long


             IO                                     MIB                                       PROFILE
  • I/O system                 • Counters for                                          • Time based probing at
  • Disk input and output      management information                                  specific interval of times
  requests                     bases                                                   • To sample anything in
  • I/O by device, process,    • IP, IPv6, ICMP, IPSec                                 the system every unit time
  size, filename


                                                        18
                               COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
SYSTEM INSPECTION AND ANALYSIS
D LANGUAGE                                                                           /* D Program */

• A D program consist of one or more probe clauses
                                                                                     probe1 description
                                                                                     /predicate/
                                                                                     {
• D Language is like C language with some                                                 actions
  constructs similar with awk :                                                      }

    • Support ANSI C operators                                                       probe2 description
                                                                                     /predicate/
    • Support Strings                                                                {
                                                                                          actions
    • D expressions are based on built-in variables :                                }
      pid, execname, timestamps, curthread
                                                                                     probe3 description
                                                                                     /predicate/
• No control-flow constructs : loops, if statements                                  {
                                                                                          actions
• Floating-point arithmetic is not permitted (only                                   }
  Integers)
                                                      19
                             COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
SYSTEM INSPECTION AND ANALYSIS
D LANGUAGE : AGGREGATIONS

                  @name[keys] = aggfunction(args)

• Used to aggregate data and look for trends


• Simple to generate report about :
    • Total system calls by a process or an application
    • Total number of read or write by process


• Aggregating functions:     • count()                                           • min()
                             • sum()                                             • max()
                             • avg()                                             • quantize()

                                                      20
                             COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
SYSTEM INSPECTION AND ANALYSIS
D LANGUAGE : SECURITY
                                                                                     D program source files




                                                                  userland
                                                                                    DTrace consumer: dtrace()
• D programs are compiled into a safe
  intermediate form that is used for
                                                                                     DTrace safe execution
  execution when a probe fires                                                           environment




                                                                  kernel
                                                                                        DTrace providers
• Programming mistakes : DTrace will
  report errors and disable instrumentation
      It is impossible to construct a bad script that would cause damage to
     the system


• DTrace handle run-time errors and report them (dividing by zero,
  dereferencing invalid memory, …)

                                                     21
                            COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
Context


DTrace Framework


System inspection and analysis


DTrace Toolkit


Demo

                                            22
                   COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
DTRACE TOOLKIT

• Collection of over 100 useful documented scripts built on top of DTrace
  Framework
      Developed by the OpenSolaris DTrace community


• The toolkit contains :
      the scripts
      the man pages
      the example documentation
      the notes files
      the tutorials


• The script are sorted by categories

                                                      23
                             COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
DTRACE TOOLKIT
CATEGORIES

                                DTrace Toolkit




                                                                                                              Extra, User, System
   Applications




                                                                                         Processes
                                                       Network

                                                                             Memory




                                                                                                     System
                                   Kernel
                        Disk
                  CPU




                               DTrace Framework
                                                          24
                                 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
Context


DTrace Framework


System inspection and analysis


DTrace Toolkit


Demo

                                            25
                   COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
DEMO


    Command line scripts                                                               Chime scripts

tcpstat                                                       system calls


                                                                System calls counter by process,
 TCP bytes received and send
                                                              function, module, …


httpdstat                                                     php calltime

                                                                Measure PHP elapsed times for
 Real-time Apache Web Server stats
                                                              functions



                                                        26
                               COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
Questions?




jerome.gauthier@alcatel-lucent.com

                              27
     COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
REFERENCES & ADDITIONAL INFORMATION

• PowerPoint presentations
    • Joyent Performance Visualization – Brendan Gregg
    • DTrace & DTrace Toolkit – Stefan Parvu


• Links
    • DTrace community site:
      http://hub.opensolaris.org/bin/view/Community+Group+dtrace/WebHome
    • Brendan Gregg site: http://www.brendangregg.com/dtrace.html
    • DTrace Blogs: http://dtrace.org/blogs/
    • DTrace online guide: http://wikis.sun.com/display/DTrace/Documentation
    • DTrace wiki: http://www.solarisinternals.com/wiki/index.php/DTraceToolkit
    • DTrace training: http://dtracehol.com


                                                        28
                               COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
29
COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.

Más contenido relacionado

Similar a Dtrace Overview

Embedded os
Embedded osEmbedded os
Embedded os
chian417
 
Ebs performance tuning session feb 13 2013---Presented by Oracle
Ebs performance tuning session  feb 13 2013---Presented by OracleEbs performance tuning session  feb 13 2013---Presented by Oracle
Ebs performance tuning session feb 13 2013---Presented by Oracle
Akash Pramanik
 
Four Ways to Improve Linux Performance IEEE Webinar, R2.0
Four Ways to Improve Linux Performance IEEE Webinar, R2.0Four Ways to Improve Linux Performance IEEE Webinar, R2.0
Four Ways to Improve Linux Performance IEEE Webinar, R2.0
Michael Christofferson
 
Coverage Solutions on Emulators
Coverage Solutions on EmulatorsCoverage Solutions on Emulators
Coverage Solutions on Emulators
DVClub
 

Similar a Dtrace Overview (20)

Embedded os
Embedded osEmbedded os
Embedded os
 
Complex Er[jl]ang Processing with StreamBase
Complex Er[jl]ang Processing with StreamBaseComplex Er[jl]ang Processing with StreamBase
Complex Er[jl]ang Processing with StreamBase
 
Juniper SRX Quickstart 12.1R3 by Thomas Schmidt
Juniper SRX Quickstart 12.1R3 by Thomas SchmidtJuniper SRX Quickstart 12.1R3 by Thomas Schmidt
Juniper SRX Quickstart 12.1R3 by Thomas Schmidt
 
Monitoring&Logging - Stanislav Kolenkin
Monitoring&Logging - Stanislav Kolenkin  Monitoring&Logging - Stanislav Kolenkin
Monitoring&Logging - Stanislav Kolenkin
 
The sFlow Standard: Scalable, Unified Monitoring of Networks, Systems and App...
The sFlow Standard: Scalable, Unified Monitoring of Networks, Systems and App...The sFlow Standard: Scalable, Unified Monitoring of Networks, Systems and App...
The sFlow Standard: Scalable, Unified Monitoring of Networks, Systems and App...
 
Ebs performance tuning session feb 13 2013---Presented by Oracle
Ebs performance tuning session  feb 13 2013---Presented by OracleEbs performance tuning session  feb 13 2013---Presented by Oracle
Ebs performance tuning session feb 13 2013---Presented by Oracle
 
Synopsys jul1411
Synopsys jul1411Synopsys jul1411
Synopsys jul1411
 
Oracle Trace File Analyzer - What's New in 12.2.1.1.0
Oracle Trace File Analyzer - What's New in 12.2.1.1.0Oracle Trace File Analyzer - What's New in 12.2.1.1.0
Oracle Trace File Analyzer - What's New in 12.2.1.1.0
 
Securing Your Linux System
Securing Your Linux SystemSecuring Your Linux System
Securing Your Linux System
 
Lab6 rtos
Lab6 rtosLab6 rtos
Lab6 rtos
 
Performance analysis and troubleshooting using DTrace
Performance analysis and troubleshooting using DTracePerformance analysis and troubleshooting using DTrace
Performance analysis and troubleshooting using DTrace
 
Four Ways to Improve Linux Performance IEEE Webinar, R2.0
Four Ways to Improve Linux Performance IEEE Webinar, R2.0Four Ways to Improve Linux Performance IEEE Webinar, R2.0
Four Ways to Improve Linux Performance IEEE Webinar, R2.0
 
Coverage Solutions on Emulators
Coverage Solutions on EmulatorsCoverage Solutions on Emulators
Coverage Solutions on Emulators
 
Introduction to SELinux Part-I
Introduction to SELinux Part-IIntroduction to SELinux Part-I
Introduction to SELinux Part-I
 
Getting optimal performance from oracle e-business suite presentation
Getting optimal performance from oracle e-business suite presentationGetting optimal performance from oracle e-business suite presentation
Getting optimal performance from oracle e-business suite presentation
 
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
 
Performance and Power Profiling on Intel Android Devices
Performance and Power Profiling on Intel Android DevicesPerformance and Power Profiling on Intel Android Devices
Performance and Power Profiling on Intel Android Devices
 
Os
OsOs
Os
 
Linux Performance Analysis and Tools
Linux Performance Analysis and ToolsLinux Performance Analysis and Tools
Linux Performance Analysis and Tools
 
Oracleonoracle dec112012
Oracleonoracle dec112012Oracleonoracle dec112012
Oracleonoracle dec112012
 

Último

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

Dtrace Overview

  • 1. DTRACE Overview Jérôme Gauthier May 2011 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 2. AGENDA 1. Context 2. DTrace Framework 3. System inspection and analysis 4. DTrace Toolkit 5. Demo 2 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 3. Context DTrace Framework System inspection and analysis DTrace Toolkit Demo 3 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 4. CONTEXT We need tools to debug and observe different situations … Understand the Analyze the system system utilization or performance saturation Debug an Debug a application system/kernel crash 4 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 5. CONTEXT … in several areas pkill pargs pflags truss mdb pgrep pstop Process Process Process control statistics debugging System Kernel Kernel statistics statistics debugging vmstat lockstat iostat cpustat kstat kmdb Examples of some Solaris commands 5 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 6. CONTEXT • Some existing utilities are process based • Some are only inspecting certain parts of the system • Disks • Virtual memory • Network • Kernel Need a tool to simplify the analysis of all parts of a system This tool must not make the system any slower 6 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 7. Context DTrace Framework System inspection and analysis DTrace Toolkit Demo 7 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 8. DTRACE FRAMEWORK • DTrace : A facility for dynamic instrumentation of production systems Another way to debug and observe the entire system and understand the big picture • Open source (CDDL = Common Development and Distribution License) • Supported platforms : Unix-like systems : 8 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 9. DTRACE FRAMEWORK User level Operating System DTRACE Programs Kernel level • Examine how the system works • Track down performance problems across many layers of software • Locate the cause of aberrant behavior Does not replace or retire other system utilities 9 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 10. DTRACE FRAMEWORK • A framework for real-time analysis and observation • Designed for live production systems A totally safe way to inspect live data on production systems No need to stop or restart applications Live measurement and interpretation • Over 30 000 data monitoring points spread in all system • Zero effect when disabled, safe and no system slowdown when enabled 10 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 11. DTRACE FRAMEWORK • Everything about DTrace is virtualized per consumer There is no limit on the number of concurrent DTrace consumers • Possibility to create custom programs to dynamically instrument the system • Example of problems that can be detected and analyzed: High CPU utilization Acute memory pressure Abnormal I/O activity Excessive network traffic 11 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 12. Context DTrace Framework System inspection and analysis DTrace Toolkit Demo 12 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 13. SYSTEM INSPECTION AND ANALYSIS PROBES • Probes are programmable sensors placed all over the system • A probe fires when the event happens Then, certain actions are executed only if the predicate expression is true • General form of a probe clause : probe description /predicate/ { actions } 13 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 14. probe description SYSTEM INSPECTION AND ANALYSIS /predicate/ PROBES { actions } • A predicate allow action to only be taken when certain conditions are met Example : Look only for a process which has the pid=1203 Match a process which has the name firefox-bin • An action can be “ record a stack trace, a timestamp, or the argument to a function ” • When some probes fire, DTrace gathers the data and reports it back to you If no action specified, DTrace will just take note of each time the probe fires 14 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 15. SYSTEM INSPECTION AND ANALYSIS PROBES • Actions are used to record data to a DTrace buffer • Different types of actions: Type of actions Example Explanation trace() Records the result of trace to the buffer Data recording printf() Traces a D expression stack() Records a kernel stack trace stop() Stops the process which has executed the probe Destructive raise() Signal a process at a precise point during execution panic() Force a crash dump exit() Stop tracing and exits Special copyin() Creates a buffer and returns its address strlen() Returns the length of a string in bytes 15 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 16. probe description SYSTEM INSPECTION AND ANALYSIS /predicate/ PROBES { actions } • Each probe is uniquely identified by a 4-tuple : < provider, module, function, name > Probe description The name of the module in which the probe is located Module Either the name of a kernel module or the name of a user library If this probe correspond to a specific program location, it’s the name Function of the program function in which the probe is located. The final component of the tuple is the string name of the probe that Name give you some idea of the probe’s semantic meaning. • Some probes does not have a module and function (e.g. : BEGIN, END) We can identify a probe only by its name 16 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 17. SYSTEM INSPECTION AND ANALYSIS PROVIDERS < provider, module, function, name > • DTrace probes come from a set of kernel modules called providers Which correspond to a particular kind of instrumentation • We can list the probes that a provider can transmit to the DTrace Framework • A provider pass the control to DTrace when you decide to enable one of its probes 17 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 18. SYSTEM INSPECTION AND ANALYSIS PROVIDERS • Example of some providers : SYSCALL PROC SCHED • Holds the entire • Handle process creation • CPU scheduling: sleeping, communication from and termination running threads userland to kernel space • Sending and handling • CPU time: which threads • Every system call on the signals are run by which CPU and system for how long IO MIB PROFILE • I/O system • Counters for • Time based probing at • Disk input and output management information specific interval of times requests bases • To sample anything in • I/O by device, process, • IP, IPv6, ICMP, IPSec the system every unit time size, filename 18 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 19. SYSTEM INSPECTION AND ANALYSIS D LANGUAGE /* D Program */ • A D program consist of one or more probe clauses probe1 description /predicate/ { • D Language is like C language with some actions constructs similar with awk : } • Support ANSI C operators probe2 description /predicate/ • Support Strings { actions • D expressions are based on built-in variables : } pid, execname, timestamps, curthread probe3 description /predicate/ • No control-flow constructs : loops, if statements { actions • Floating-point arithmetic is not permitted (only } Integers) 19 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 20. SYSTEM INSPECTION AND ANALYSIS D LANGUAGE : AGGREGATIONS @name[keys] = aggfunction(args) • Used to aggregate data and look for trends • Simple to generate report about : • Total system calls by a process or an application • Total number of read or write by process • Aggregating functions: • count() • min() • sum() • max() • avg() • quantize() 20 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 21. SYSTEM INSPECTION AND ANALYSIS D LANGUAGE : SECURITY D program source files userland DTrace consumer: dtrace() • D programs are compiled into a safe intermediate form that is used for DTrace safe execution execution when a probe fires environment kernel DTrace providers • Programming mistakes : DTrace will report errors and disable instrumentation It is impossible to construct a bad script that would cause damage to the system • DTrace handle run-time errors and report them (dividing by zero, dereferencing invalid memory, …) 21 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 22. Context DTrace Framework System inspection and analysis DTrace Toolkit Demo 22 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 23. DTRACE TOOLKIT • Collection of over 100 useful documented scripts built on top of DTrace Framework Developed by the OpenSolaris DTrace community • The toolkit contains : the scripts the man pages the example documentation the notes files the tutorials • The script are sorted by categories 23 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 24. DTRACE TOOLKIT CATEGORIES DTrace Toolkit Extra, User, System Applications Processes Network Memory System Kernel Disk CPU DTrace Framework 24 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 25. Context DTrace Framework System inspection and analysis DTrace Toolkit Demo 25 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 26. DEMO Command line scripts Chime scripts tcpstat system calls System calls counter by process, TCP bytes received and send function, module, … httpdstat php calltime Measure PHP elapsed times for Real-time Apache Web Server stats functions 26 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 27. Questions? jerome.gauthier@alcatel-lucent.com 27 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 28. REFERENCES & ADDITIONAL INFORMATION • PowerPoint presentations • Joyent Performance Visualization – Brendan Gregg • DTrace & DTrace Toolkit – Stefan Parvu • Links • DTrace community site: http://hub.opensolaris.org/bin/view/Community+Group+dtrace/WebHome • Brendan Gregg site: http://www.brendangregg.com/dtrace.html • DTrace Blogs: http://dtrace.org/blogs/ • DTrace online guide: http://wikis.sun.com/display/DTrace/Documentation • DTrace wiki: http://www.solarisinternals.com/wiki/index.php/DTraceToolkit • DTrace training: http://dtracehol.com 28 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.
  • 29. 29 COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.