SlideShare a Scribd company logo
USE              IMPROVE                   EVANGELIZE


Observability Matters:
How DTrace Helped Twitter
Adam Leventhal
Brendan Gregg

FishWorks
Sun Microsystems
a version of this presentation with the demo materials will be available shortly after the conference at http://blogs.sun.com/ahl
USE   IMPROVE   EVANGELIZE




This Talk
    Twitter performance meltdown
โ—

    Introduction to DTrace
โ—

    DTrace on the case
โ—

    Solutions and results
โ—

    DTrace for your application
โ—

    Q&A
โ—




                                              2
USE     IMPROVE   EVANGELIZE




What Is Twitter?
    Social networking/RSS/SMS
โ—

    Ruby on Rails application
โ—

    Horizontally scaled
โ—

    Centralized MySQL backend
โ—




                                              3
USE     IMPROVE   EVANGELIZE




Twitter's Problem
    Started with a few users
โ—

    Didn't scale with their success
โ—

    High latencies could make it unusable
โ—

    Many possible suspects:
โ—

        The OS: kernel, libraries, etc.
    โ€“

        Ruby, MySQL, Apache
    โ€“

        The Twitter application itself
    โ€“


                                                        4
USE    IMPROVE   EVANGELIZE




Enter DTrace
    Luckily: Twitter had DTrace
โ—
        Solaris 10, Mac OS X 10.5, FreeBSD*
    โ€“

    Systemic observability
โ—
        Ruby, Java, JavaScript, C/C++, kernel ...
    โ€“

    Concise answers to arbitrary questions
โ—

    Designed for production systems
โ—

        Architected to always be safe
    โ€“

        No overhead when not in use
    โ€“

    Also great for developers
โ—                                                           5
USE   IMPROVE   EVANGELIZE




DEMO

                       6
USE   IMPROVE   EVANGELIZE




The Investigation
    High latencies under load
โ—

    What could cause these latencies?
โ—

        on-CPU time: slow/numerous functions, ...
    โ€“

        off-CPU time: I/O, lock contention, ...
    โ€“




                                                      7
USE   IMPROVE   EVANGELIZE




DEMO

                       8
USE   IMPROVE   EVANGELIZE




Investigation: Steps
1. Started with a broad look at the system
 using familiar tools
     mpstat, ...
 โ—



2. DTrace profiling to sample processes
3. DTrace profiling to sample user stacks




                                             9
USE   IMPROVE   EVANGELIZE




Investigation: So Far
    What we knew:
โ—

        High application latency (from somewhere)
    โ€“

    What we learned:
โ—

        Latency may be due to high CPU load
    โ€“

        CPU load is due to some Ruby component:
    โ€“
             Twitter application
         โ—


             Standard Ruby libraries
         โ—


             Interpreter itself
         โ—




                                                           10
USE   IMPROVE   EVANGELIZE




DEMO

                       11
USE   IMPROVE   EVANGELIZE




Investigation: Steps
4. Function call counts
5. ustack() for memcpy()
6. Time spent in backtrace()

    What we learned:
โ—

        40% of CPU time spent in backtrace()
    โ€“




                                                   12
USE   IMPROVE   EVANGELIZE




DEMO

                       13
USE   IMPROVE   EVANGELIZE




Investigation: Steps
7. Located source of backtrace() calls in
  Ruby code

    What we learned:
โ—

        Several instances of code like this:
    โ€“
         @string = (str.string rescue str)




                                                     14
USE   IMPROVE   EVANGELIZE




Results: No Exceptions
    Rather than blithely calling the method:
โ—
    @string = (str.string rescue str)

    ... check first:
โ—
    @string = str.responds_to?(:string) ?
        str.string : str

    Result: 30% drop in CPU utilization
โ—



                                                15
USE   IMPROVE   EVANGELIZE




Ruby Provider
    Joyent built DTrace-enabled Ruby
โ—

    Trace function entry and return
โ—

    Probes for line execution, memory
โ—
    allocation, etc.




                                               16
USE   IMPROVE   EVANGELIZE




DEMO

                       17
USE   IMPROVE   EVANGELIZE




Results: CRC32 in C
    Precision optimization
โ—

    Rewrite the CRC32 computation in C
โ—

    Estimated result: 15% drop in CPU
โ—
    utilization




                                              18
USE   IMPROVE   EVANGELIZE




DTrace Your Application
    Get your application on an OS with
โ—
    DTrace
    Start with the tools you know and dive
โ—
    deeper with DTrace
    If you can do it today or tomorrow, find
โ—
    Adam and Brendan: we'll help you
    investigate
    DTrace sees all
โ—


                                                19
USE    IMPROVE   EVANGELIZE




    Q&A (and links)
    DTrace home page
โ€“
         http://www.opensolaris.org/os/community/dtrace
     โ—


    DTrace-enabled Ruby
โ€“
         http://dtrace.joyent.com
     โ—


    Getting started with DTrace
โ€“
         http://blogs.sun.com/ahl/entry/dtrace_boot_camp
     โ—


    Exception problem:
โ€“
         http://dev.rubyonrails.org/ticket/8159
     โ—


         http://dev.rubyonrails.org/changeset/6571
     โ—


    Joyent's blog post on this subject
โ€“
         http://joyeur.com/2007/04/24/solaris-dtrace-and-rails   20
     โ—
USE      IMPROVE   EVANGELIZE


Observability Matters:
How DTrace Helped Twitter
Adam Leventhal
http://blogs.sun.com/ahl

Brendan Gregg
http://blogs.sun.com/brendan

More Related Content

What's hot

Composer | PHP Dependency Manager
Composer | PHP Dependency ManagerComposer | PHP Dependency Manager
Composer | PHP Dependency Manager
Ujjwal Ojha
ย 
Dist::Zilla - A very brief introduction
Dist::Zilla - A very brief introductionDist::Zilla - A very brief introduction
Dist::Zilla - A very brief introduction
Dean Hamstead
ย 
Maven 3.0 at ร˜redev
Maven 3.0 at ร˜redevMaven 3.0 at ร˜redev
Maven 3.0 at ร˜redev
Matthew McCullough
ย 
Leaner microservices with Java 10
Leaner microservices with Java 10Leaner microservices with Java 10
Leaner microservices with Java 10
Arto Santala
ย 
Swoole Love PHP
Swoole Love PHPSwoole Love PHP
Swoole Love PHP
Yi-Feng Tzeng
ย 
Symfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim RomanovskySymfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim Romanovsky
php-user-group-minsk
ย 
Capistrano
CapistranoCapistrano
Capistrano
Bryan McLellan
ย 
Managing Complexity with Module::Release
Managing Complexity with Module::ReleaseManaging Complexity with Module::Release
Managing Complexity with Module::Release
brian d foy
ย 
The Integration of Laravel with Swoole
The Integration of Laravel with SwooleThe Integration of Laravel with Swoole
The Integration of Laravel with Swoole
Albert Chen
ย 
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
Tim Bunce
ย 
perlbrew yapcasia 2010
perlbrew yapcasia 2010perlbrew yapcasia 2010
perlbrew yapcasia 2010
Kang-min Liu
ย 
Fastlane - ATC 2016
Fastlane - ATC 2016Fastlane - ATC 2016
Fastlane - ATC 2016
Pablo Menezes
ย 
Composer Helpdesk
Composer HelpdeskComposer Helpdesk
Composer HelpdeskSven Rautenberg
ย 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with ComposerJason Grimes
ย 
Defcon - Veil-Pillage
Defcon - Veil-PillageDefcon - Veil-Pillage
Defcon - Veil-Pillage
VeilFramework
ย 
[Part 1] automation of home appliances using raspberry pi โ€“ software installa...
[Part 1] automation of home appliances using raspberry pi โ€“ software installa...[Part 1] automation of home appliances using raspberry pi โ€“ software installa...
[Part 1] automation of home appliances using raspberry pi โ€“ software installa...
Azilen Technologies Pvt. Ltd.
ย 
4. open mano set up and usage
4. open mano set up and usage4. open mano set up and usage
4. open mano set up and usage
videos
ย 
FITC - Node.js 101
FITC - Node.js 101FITC - Node.js 101
FITC - Node.js 101
Rami Sayar
ย 
Adding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard
Adding_GD2_to_PHP_on_OS_X_Server_10_5_LeopardAdding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard
Adding_GD2_to_PHP_on_OS_X_Server_10_5_Leopardtutorialsruby
ย 

What's hot (20)

Composer | PHP Dependency Manager
Composer | PHP Dependency ManagerComposer | PHP Dependency Manager
Composer | PHP Dependency Manager
ย 
Dist::Zilla - A very brief introduction
Dist::Zilla - A very brief introductionDist::Zilla - A very brief introduction
Dist::Zilla - A very brief introduction
ย 
Maven 3.0 at ร˜redev
Maven 3.0 at ร˜redevMaven 3.0 at ร˜redev
Maven 3.0 at ร˜redev
ย 
Leaner microservices with Java 10
Leaner microservices with Java 10Leaner microservices with Java 10
Leaner microservices with Java 10
ย 
Swoole Love PHP
Swoole Love PHPSwoole Love PHP
Swoole Love PHP
ย 
Perlbrew
PerlbrewPerlbrew
Perlbrew
ย 
Symfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim RomanovskySymfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim Romanovsky
ย 
Capistrano
CapistranoCapistrano
Capistrano
ย 
Managing Complexity with Module::Release
Managing Complexity with Module::ReleaseManaging Complexity with Module::Release
Managing Complexity with Module::Release
ย 
The Integration of Laravel with Swoole
The Integration of Laravel with SwooleThe Integration of Laravel with Swoole
The Integration of Laravel with Swoole
ย 
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
ย 
perlbrew yapcasia 2010
perlbrew yapcasia 2010perlbrew yapcasia 2010
perlbrew yapcasia 2010
ย 
Fastlane - ATC 2016
Fastlane - ATC 2016Fastlane - ATC 2016
Fastlane - ATC 2016
ย 
Composer Helpdesk
Composer HelpdeskComposer Helpdesk
Composer Helpdesk
ย 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with Composer
ย 
Defcon - Veil-Pillage
Defcon - Veil-PillageDefcon - Veil-Pillage
Defcon - Veil-Pillage
ย 
[Part 1] automation of home appliances using raspberry pi โ€“ software installa...
[Part 1] automation of home appliances using raspberry pi โ€“ software installa...[Part 1] automation of home appliances using raspberry pi โ€“ software installa...
[Part 1] automation of home appliances using raspberry pi โ€“ software installa...
ย 
4. open mano set up and usage
4. open mano set up and usage4. open mano set up and usage
4. open mano set up and usage
ย 
FITC - Node.js 101
FITC - Node.js 101FITC - Node.js 101
FITC - Node.js 101
ย 
Adding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard
Adding_GD2_to_PHP_on_OS_X_Server_10_5_LeopardAdding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard
Adding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard
ย 

Viewers also liked

DTrace
DTraceDTrace
DTrace
Marcus Crafter
ย 
DTrace - Miracle Scotland Database Forum
DTrace - Miracle Scotland Database ForumDTrace - Miracle Scotland Database Forum
DTrace - Miracle Scotland Database ForumDoug Burns
ย 
DTrace talk at Oracle Open World
DTrace talk at Oracle Open WorldDTrace talk at Oracle Open World
DTrace talk at Oracle Open WorldAngelo Rajadurai
ย 
OpenSolaris 2009.06 Workshop
OpenSolaris 2009.06 WorkshopOpenSolaris 2009.06 Workshop
OpenSolaris 2009.06 Workshop
Iban Nieto Castillero
ย 
Oraclew2013 devopsjlm
Oraclew2013 devopsjlmOraclew2013 devopsjlm
Oraclew2013 devopsjlm
Nadav Lankin
ย 
Cloud Observation and Performance Analysis using Solaris 11 DTrace
Cloud Observation and Performance Analysis using Solaris 11 DTraceCloud Observation and Performance Analysis using Solaris 11 DTrace
Cloud Observation and Performance Analysis using Solaris 11 DTrace
Orgad Kimchi
ย 
Solaris Internals Preso circa 2009
Solaris Internals Preso circa 2009Solaris Internals Preso circa 2009
Solaris Internals Preso circa 2009
Richard McDougall
ย 
Facebook Powerpoint
Facebook PowerpointFacebook Powerpoint
Facebook Powerpointmyra14
ย 

Viewers also liked (8)

DTrace
DTraceDTrace
DTrace
ย 
DTrace - Miracle Scotland Database Forum
DTrace - Miracle Scotland Database ForumDTrace - Miracle Scotland Database Forum
DTrace - Miracle Scotland Database Forum
ย 
DTrace talk at Oracle Open World
DTrace talk at Oracle Open WorldDTrace talk at Oracle Open World
DTrace talk at Oracle Open World
ย 
OpenSolaris 2009.06 Workshop
OpenSolaris 2009.06 WorkshopOpenSolaris 2009.06 Workshop
OpenSolaris 2009.06 Workshop
ย 
Oraclew2013 devopsjlm
Oraclew2013 devopsjlmOraclew2013 devopsjlm
Oraclew2013 devopsjlm
ย 
Cloud Observation and Performance Analysis using Solaris 11 DTrace
Cloud Observation and Performance Analysis using Solaris 11 DTraceCloud Observation and Performance Analysis using Solaris 11 DTrace
Cloud Observation and Performance Analysis using Solaris 11 DTrace
ย 
Solaris Internals Preso circa 2009
Solaris Internals Preso circa 2009Solaris Internals Preso circa 2009
Solaris Internals Preso circa 2009
ย 
Facebook Powerpoint
Facebook PowerpointFacebook Powerpoint
Facebook Powerpoint
ย 

Similar to Os Leventhal

Troubleshooting Deep Neural Networks - Full Stack Deep Learning
Troubleshooting Deep Neural Networks - Full Stack Deep LearningTroubleshooting Deep Neural Networks - Full Stack Deep Learning
Troubleshooting Deep Neural Networks - Full Stack Deep Learning
Sergey Karayev
ย 
So. many. vulnerabilities. Why are containers such a mess and what to do abou...
So. many. vulnerabilities. Why are containers such a mess and what to do abou...So. many. vulnerabilities. Why are containers such a mess and what to do abou...
So. many. vulnerabilities. Why are containers such a mess and what to do abou...
Eric Smalling
ย 
Performance Analysis of Idle Programs
Performance Analysis of Idle ProgramsPerformance Analysis of Idle Programs
Performance Analysis of Idle Programs
greenwop
ย 
It's always sunny with OpenJ9
It's always sunny with OpenJ9It's always sunny with OpenJ9
It's always sunny with OpenJ9
DanHeidinga
ย 
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
srisatish ambati
ย 
Os Selbak
Os SelbakOs Selbak
Os Selbakoscon2007
ย 
Puppet for Sys Admins
Puppet for Sys AdminsPuppet for Sys Admins
Puppet for Sys Admins
Puppet
ย 
Binding android piece by piece
Binding android piece by pieceBinding android piece by piece
Binding android piece by piece
Bucharest Java User Group
ย 
STAMP, or Test Amplification to DevTestOps service, OW2con'18, June 7-8, 2018...
STAMP, or Test Amplification to DevTestOps service, OW2con'18, June 7-8, 2018...STAMP, or Test Amplification to DevTestOps service, OW2con'18, June 7-8, 2018...
STAMP, or Test Amplification to DevTestOps service, OW2con'18, June 7-8, 2018...
OW2
ย 
Drupalcamp Simpletest
Drupalcamp SimpletestDrupalcamp Simpletest
Drupalcamp Simpletestlyricnz
ย 
Testing In Drupal
Testing In DrupalTesting In Drupal
Testing In Drupal
Ryan Cross
ย 
Continuous Integration Testing in Django
Continuous Integration Testing in DjangoContinuous Integration Testing in Django
Continuous Integration Testing in Django
Kevin Harvey
ย 
Joxean Koret - Database Security Paradise [Rooted CON 2011]
Joxean Koret - Database Security Paradise [Rooted CON 2011]Joxean Koret - Database Security Paradise [Rooted CON 2011]
Joxean Koret - Database Security Paradise [Rooted CON 2011]RootedCON
ย 
The Diabolical Developer's Guide to Surviving Java 9
The Diabolical Developer's Guide to Surviving Java 9The Diabolical Developer's Guide to Surviving Java 9
The Diabolical Developer's Guide to Surviving Java 9
jClarity
ย 
Surge2012
Surge2012Surge2012
Surge2012
davidapacheco
ย 
Gatling - Bordeaux JUG
Gatling - Bordeaux JUGGatling - Bordeaux JUG
Gatling - Bordeaux JUGslandelle
ย 
PAC 2019 virtual Christoph NEUMรœLLER
PAC 2019 virtual Christoph NEUMรœLLERPAC 2019 virtual Christoph NEUMรœLLER
PAC 2019 virtual Christoph NEUMรœLLER
Neotys
ย 
Containerize your Blackbox tests
Containerize your Blackbox testsContainerize your Blackbox tests
Containerize your Blackbox tests
Kevin Beeman
ย 
Monitoring MySQL with DTrace/SystemTap
Monitoring MySQL with DTrace/SystemTapMonitoring MySQL with DTrace/SystemTap
Monitoring MySQL with DTrace/SystemTap
Padraig O'Sullivan
ย 
Techniques for Preserving Scientific Software Executions: Preserve the Mess o...
Techniques for Preserving Scientific Software Executions: Preserve the Mess o...Techniques for Preserving Scientific Software Executions: Preserve the Mess o...
Techniques for Preserving Scientific Software Executions: Preserve the Mess o...
12th International Conference on Digital Preservation (iPRES 2015)
ย 

Similar to Os Leventhal (20)

Troubleshooting Deep Neural Networks - Full Stack Deep Learning
Troubleshooting Deep Neural Networks - Full Stack Deep LearningTroubleshooting Deep Neural Networks - Full Stack Deep Learning
Troubleshooting Deep Neural Networks - Full Stack Deep Learning
ย 
So. many. vulnerabilities. Why are containers such a mess and what to do abou...
So. many. vulnerabilities. Why are containers such a mess and what to do abou...So. many. vulnerabilities. Why are containers such a mess and what to do abou...
So. many. vulnerabilities. Why are containers such a mess and what to do abou...
ย 
Performance Analysis of Idle Programs
Performance Analysis of Idle ProgramsPerformance Analysis of Idle Programs
Performance Analysis of Idle Programs
ย 
It's always sunny with OpenJ9
It's always sunny with OpenJ9It's always sunny with OpenJ9
It's always sunny with OpenJ9
ย 
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
ย 
Os Selbak
Os SelbakOs Selbak
Os Selbak
ย 
Puppet for Sys Admins
Puppet for Sys AdminsPuppet for Sys Admins
Puppet for Sys Admins
ย 
Binding android piece by piece
Binding android piece by pieceBinding android piece by piece
Binding android piece by piece
ย 
STAMP, or Test Amplification to DevTestOps service, OW2con'18, June 7-8, 2018...
STAMP, or Test Amplification to DevTestOps service, OW2con'18, June 7-8, 2018...STAMP, or Test Amplification to DevTestOps service, OW2con'18, June 7-8, 2018...
STAMP, or Test Amplification to DevTestOps service, OW2con'18, June 7-8, 2018...
ย 
Drupalcamp Simpletest
Drupalcamp SimpletestDrupalcamp Simpletest
Drupalcamp Simpletest
ย 
Testing In Drupal
Testing In DrupalTesting In Drupal
Testing In Drupal
ย 
Continuous Integration Testing in Django
Continuous Integration Testing in DjangoContinuous Integration Testing in Django
Continuous Integration Testing in Django
ย 
Joxean Koret - Database Security Paradise [Rooted CON 2011]
Joxean Koret - Database Security Paradise [Rooted CON 2011]Joxean Koret - Database Security Paradise [Rooted CON 2011]
Joxean Koret - Database Security Paradise [Rooted CON 2011]
ย 
The Diabolical Developer's Guide to Surviving Java 9
The Diabolical Developer's Guide to Surviving Java 9The Diabolical Developer's Guide to Surviving Java 9
The Diabolical Developer's Guide to Surviving Java 9
ย 
Surge2012
Surge2012Surge2012
Surge2012
ย 
Gatling - Bordeaux JUG
Gatling - Bordeaux JUGGatling - Bordeaux JUG
Gatling - Bordeaux JUG
ย 
PAC 2019 virtual Christoph NEUMรœLLER
PAC 2019 virtual Christoph NEUMรœLLERPAC 2019 virtual Christoph NEUMรœLLER
PAC 2019 virtual Christoph NEUMรœLLER
ย 
Containerize your Blackbox tests
Containerize your Blackbox testsContainerize your Blackbox tests
Containerize your Blackbox tests
ย 
Monitoring MySQL with DTrace/SystemTap
Monitoring MySQL with DTrace/SystemTapMonitoring MySQL with DTrace/SystemTap
Monitoring MySQL with DTrace/SystemTap
ย 
Techniques for Preserving Scientific Software Executions: Preserve the Mess o...
Techniques for Preserving Scientific Software Executions: Preserve the Mess o...Techniques for Preserving Scientific Software Executions: Preserve the Mess o...
Techniques for Preserving Scientific Software Executions: Preserve the Mess o...
ย 

More from oscon2007

J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Touroscon2007
ย 
Solr Presentation5
Solr Presentation5Solr Presentation5
Solr Presentation5oscon2007
ย 
Os Borger
Os BorgerOs Borger
Os Borgeroscon2007
ย 
Os Harkins
Os HarkinsOs Harkins
Os Harkinsoscon2007
ย 
Os Fitzpatrick Sussman Wiifm
Os Fitzpatrick Sussman WiifmOs Fitzpatrick Sussman Wiifm
Os Fitzpatrick Sussman Wiifmoscon2007
ย 
Os Bunce
Os BunceOs Bunce
Os Bunceoscon2007
ย 
Yuicss R7
Yuicss R7Yuicss R7
Yuicss R7oscon2007
ย 
Performance Whack A Mole
Performance Whack A MolePerformance Whack A Mole
Performance Whack A Moleoscon2007
ย 
Os Fogel
Os FogelOs Fogel
Os Fogeloscon2007
ย 
Os Lanphier Brashears
Os Lanphier BrashearsOs Lanphier Brashears
Os Lanphier Brashearsoscon2007
ย 
Os Tucker
Os TuckerOs Tucker
Os Tuckeroscon2007
ย 
Os Fitzpatrick Sussman Swp
Os Fitzpatrick Sussman SwpOs Fitzpatrick Sussman Swp
Os Fitzpatrick Sussman Swposcon2007
ย 
Os Furlong
Os FurlongOs Furlong
Os Furlongoscon2007
ย 
Os Berlin Dispelling Myths
Os Berlin Dispelling MythsOs Berlin Dispelling Myths
Os Berlin Dispelling Mythsoscon2007
ย 
Os Kimsal
Os KimsalOs Kimsal
Os Kimsaloscon2007
ย 
Os Pruett
Os PruettOs Pruett
Os Pruettoscon2007
ย 
Os Alrubaie
Os AlrubaieOs Alrubaie
Os Alrubaieoscon2007
ย 
Os Keysholistic
Os KeysholisticOs Keysholistic
Os Keysholisticoscon2007
ย 
Os Jonphillips
Os JonphillipsOs Jonphillips
Os Jonphillipsoscon2007
ย 
Os Urnerupdated
Os UrnerupdatedOs Urnerupdated
Os Urnerupdatedoscon2007
ย 

More from oscon2007 (20)

J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Tour
ย 
Solr Presentation5
Solr Presentation5Solr Presentation5
Solr Presentation5
ย 
Os Borger
Os BorgerOs Borger
Os Borger
ย 
Os Harkins
Os HarkinsOs Harkins
Os Harkins
ย 
Os Fitzpatrick Sussman Wiifm
Os Fitzpatrick Sussman WiifmOs Fitzpatrick Sussman Wiifm
Os Fitzpatrick Sussman Wiifm
ย 
Os Bunce
Os BunceOs Bunce
Os Bunce
ย 
Yuicss R7
Yuicss R7Yuicss R7
Yuicss R7
ย 
Performance Whack A Mole
Performance Whack A MolePerformance Whack A Mole
Performance Whack A Mole
ย 
Os Fogel
Os FogelOs Fogel
Os Fogel
ย 
Os Lanphier Brashears
Os Lanphier BrashearsOs Lanphier Brashears
Os Lanphier Brashears
ย 
Os Tucker
Os TuckerOs Tucker
Os Tucker
ย 
Os Fitzpatrick Sussman Swp
Os Fitzpatrick Sussman SwpOs Fitzpatrick Sussman Swp
Os Fitzpatrick Sussman Swp
ย 
Os Furlong
Os FurlongOs Furlong
Os Furlong
ย 
Os Berlin Dispelling Myths
Os Berlin Dispelling MythsOs Berlin Dispelling Myths
Os Berlin Dispelling Myths
ย 
Os Kimsal
Os KimsalOs Kimsal
Os Kimsal
ย 
Os Pruett
Os PruettOs Pruett
Os Pruett
ย 
Os Alrubaie
Os AlrubaieOs Alrubaie
Os Alrubaie
ย 
Os Keysholistic
Os KeysholisticOs Keysholistic
Os Keysholistic
ย 
Os Jonphillips
Os JonphillipsOs Jonphillips
Os Jonphillips
ย 
Os Urnerupdated
Os UrnerupdatedOs Urnerupdated
Os Urnerupdated
ย 

Recently uploaded

Introduction to Amazon company 111111111111
Introduction to Amazon company 111111111111Introduction to Amazon company 111111111111
Introduction to Amazon company 111111111111
zoyaansari11365
ย 
What are the main advantages of using HR recruiter services.pdf
What are the main advantages of using HR recruiter services.pdfWhat are the main advantages of using HR recruiter services.pdf
What are the main advantages of using HR recruiter services.pdf
HumanResourceDimensi1
ย 
Buy Verified PayPal Account | Buy Google 5 Star Reviews
Buy Verified PayPal Account | Buy Google 5 Star ReviewsBuy Verified PayPal Account | Buy Google 5 Star Reviews
Buy Verified PayPal Account | Buy Google 5 Star Reviews
usawebmarket
ย 
RMD24 | Debunking the non-endemic revenue myth Marvin Vacquier Droop | First ...
RMD24 | Debunking the non-endemic revenue myth Marvin Vacquier Droop | First ...RMD24 | Debunking the non-endemic revenue myth Marvin Vacquier Droop | First ...
RMD24 | Debunking the non-endemic revenue myth Marvin Vacquier Droop | First ...
BBPMedia1
ย 
April 2024 Nostalgia Products Newsletter
April 2024 Nostalgia Products NewsletterApril 2024 Nostalgia Products Newsletter
April 2024 Nostalgia Products Newsletter
NathanBaughman3
ย 
Affordable Stationery Printing Services in Jaipur | Navpack n Print
Affordable Stationery Printing Services in Jaipur | Navpack n PrintAffordable Stationery Printing Services in Jaipur | Navpack n Print
Affordable Stationery Printing Services in Jaipur | Navpack n Print
Navpack & Print
ย 
Digital Transformation and IT Strategy Toolkit and Templates
Digital Transformation and IT Strategy Toolkit and TemplatesDigital Transformation and IT Strategy Toolkit and Templates
Digital Transformation and IT Strategy Toolkit and Templates
Aurelien Domont, MBA
ย 
falcon-invoice-discounting-a-premier-platform-for-investors-in-india
falcon-invoice-discounting-a-premier-platform-for-investors-in-indiafalcon-invoice-discounting-a-premier-platform-for-investors-in-india
falcon-invoice-discounting-a-premier-platform-for-investors-in-india
Falcon Invoice Discounting
ย 
Putting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptxPutting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptx
Cynthia Clay
ย 
Discover the innovative and creative projects that highlight my journey throu...
Discover the innovative and creative projects that highlight my journey throu...Discover the innovative and creative projects that highlight my journey throu...
Discover the innovative and creative projects that highlight my journey throu...
dylandmeas
ย 
20240425_ TJ Communications Credentials_compressed.pdf
20240425_ TJ Communications Credentials_compressed.pdf20240425_ TJ Communications Credentials_compressed.pdf
20240425_ TJ Communications Credentials_compressed.pdf
tjcomstrang
ย 
Search Disrupted Googleโ€™s Leaked Documents Rock the SEO World.pdf
Search Disrupted Googleโ€™s Leaked Documents Rock the SEO World.pdfSearch Disrupted Googleโ€™s Leaked Documents Rock the SEO World.pdf
Search Disrupted Googleโ€™s Leaked Documents Rock the SEO World.pdf
Arihant Webtech Pvt. Ltd
ย 
Memorandum Of Association Constitution of Company.ppt
Memorandum Of Association Constitution of Company.pptMemorandum Of Association Constitution of Company.ppt
Memorandum Of Association Constitution of Company.ppt
seri bangash
ย 
ikea_woodgreen_petscharity_dog-alogue_digital.pdf
ikea_woodgreen_petscharity_dog-alogue_digital.pdfikea_woodgreen_petscharity_dog-alogue_digital.pdf
ikea_woodgreen_petscharity_dog-alogue_digital.pdf
agatadrynko
ย 
Brand Analysis for an artist named Struan
Brand Analysis for an artist named StruanBrand Analysis for an artist named Struan
Brand Analysis for an artist named Struan
sarahvanessa51503
ย 
The effects of customers service quality and online reviews on customer loyal...
The effects of customers service quality and online reviews on customer loyal...The effects of customers service quality and online reviews on customer loyal...
The effects of customers service quality and online reviews on customer loyal...
balatucanapplelovely
ย 
Business Valuation Principles for Entrepreneurs
Business Valuation Principles for EntrepreneursBusiness Valuation Principles for Entrepreneurs
Business Valuation Principles for Entrepreneurs
Ben Wann
ย 
Project File Report BBA 6th semester.pdf
Project File Report BBA 6th semester.pdfProject File Report BBA 6th semester.pdf
Project File Report BBA 6th semester.pdf
RajPriye
ย 
CADAVER AS OUR FIRST TEACHER anatomt in your.pptx
CADAVER AS OUR FIRST TEACHER anatomt in your.pptxCADAVER AS OUR FIRST TEACHER anatomt in your.pptx
CADAVER AS OUR FIRST TEACHER anatomt in your.pptx
fakeloginn69
ย 
The Influence of Marketing Strategy and Market Competition on Business Perfor...
The Influence of Marketing Strategy and Market Competition on Business Perfor...The Influence of Marketing Strategy and Market Competition on Business Perfor...
The Influence of Marketing Strategy and Market Competition on Business Perfor...
Adam Smith
ย 

Recently uploaded (20)

Introduction to Amazon company 111111111111
Introduction to Amazon company 111111111111Introduction to Amazon company 111111111111
Introduction to Amazon company 111111111111
ย 
What are the main advantages of using HR recruiter services.pdf
What are the main advantages of using HR recruiter services.pdfWhat are the main advantages of using HR recruiter services.pdf
What are the main advantages of using HR recruiter services.pdf
ย 
Buy Verified PayPal Account | Buy Google 5 Star Reviews
Buy Verified PayPal Account | Buy Google 5 Star ReviewsBuy Verified PayPal Account | Buy Google 5 Star Reviews
Buy Verified PayPal Account | Buy Google 5 Star Reviews
ย 
RMD24 | Debunking the non-endemic revenue myth Marvin Vacquier Droop | First ...
RMD24 | Debunking the non-endemic revenue myth Marvin Vacquier Droop | First ...RMD24 | Debunking the non-endemic revenue myth Marvin Vacquier Droop | First ...
RMD24 | Debunking the non-endemic revenue myth Marvin Vacquier Droop | First ...
ย 
April 2024 Nostalgia Products Newsletter
April 2024 Nostalgia Products NewsletterApril 2024 Nostalgia Products Newsletter
April 2024 Nostalgia Products Newsletter
ย 
Affordable Stationery Printing Services in Jaipur | Navpack n Print
Affordable Stationery Printing Services in Jaipur | Navpack n PrintAffordable Stationery Printing Services in Jaipur | Navpack n Print
Affordable Stationery Printing Services in Jaipur | Navpack n Print
ย 
Digital Transformation and IT Strategy Toolkit and Templates
Digital Transformation and IT Strategy Toolkit and TemplatesDigital Transformation and IT Strategy Toolkit and Templates
Digital Transformation and IT Strategy Toolkit and Templates
ย 
falcon-invoice-discounting-a-premier-platform-for-investors-in-india
falcon-invoice-discounting-a-premier-platform-for-investors-in-indiafalcon-invoice-discounting-a-premier-platform-for-investors-in-india
falcon-invoice-discounting-a-premier-platform-for-investors-in-india
ย 
Putting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptxPutting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptx
ย 
Discover the innovative and creative projects that highlight my journey throu...
Discover the innovative and creative projects that highlight my journey throu...Discover the innovative and creative projects that highlight my journey throu...
Discover the innovative and creative projects that highlight my journey throu...
ย 
20240425_ TJ Communications Credentials_compressed.pdf
20240425_ TJ Communications Credentials_compressed.pdf20240425_ TJ Communications Credentials_compressed.pdf
20240425_ TJ Communications Credentials_compressed.pdf
ย 
Search Disrupted Googleโ€™s Leaked Documents Rock the SEO World.pdf
Search Disrupted Googleโ€™s Leaked Documents Rock the SEO World.pdfSearch Disrupted Googleโ€™s Leaked Documents Rock the SEO World.pdf
Search Disrupted Googleโ€™s Leaked Documents Rock the SEO World.pdf
ย 
Memorandum Of Association Constitution of Company.ppt
Memorandum Of Association Constitution of Company.pptMemorandum Of Association Constitution of Company.ppt
Memorandum Of Association Constitution of Company.ppt
ย 
ikea_woodgreen_petscharity_dog-alogue_digital.pdf
ikea_woodgreen_petscharity_dog-alogue_digital.pdfikea_woodgreen_petscharity_dog-alogue_digital.pdf
ikea_woodgreen_petscharity_dog-alogue_digital.pdf
ย 
Brand Analysis for an artist named Struan
Brand Analysis for an artist named StruanBrand Analysis for an artist named Struan
Brand Analysis for an artist named Struan
ย 
The effects of customers service quality and online reviews on customer loyal...
The effects of customers service quality and online reviews on customer loyal...The effects of customers service quality and online reviews on customer loyal...
The effects of customers service quality and online reviews on customer loyal...
ย 
Business Valuation Principles for Entrepreneurs
Business Valuation Principles for EntrepreneursBusiness Valuation Principles for Entrepreneurs
Business Valuation Principles for Entrepreneurs
ย 
Project File Report BBA 6th semester.pdf
Project File Report BBA 6th semester.pdfProject File Report BBA 6th semester.pdf
Project File Report BBA 6th semester.pdf
ย 
CADAVER AS OUR FIRST TEACHER anatomt in your.pptx
CADAVER AS OUR FIRST TEACHER anatomt in your.pptxCADAVER AS OUR FIRST TEACHER anatomt in your.pptx
CADAVER AS OUR FIRST TEACHER anatomt in your.pptx
ย 
The Influence of Marketing Strategy and Market Competition on Business Perfor...
The Influence of Marketing Strategy and Market Competition on Business Perfor...The Influence of Marketing Strategy and Market Competition on Business Perfor...
The Influence of Marketing Strategy and Market Competition on Business Perfor...
ย 

Os Leventhal

  • 1. USE IMPROVE EVANGELIZE Observability Matters: How DTrace Helped Twitter Adam Leventhal Brendan Gregg FishWorks Sun Microsystems a version of this presentation with the demo materials will be available shortly after the conference at http://blogs.sun.com/ahl
  • 2. USE IMPROVE EVANGELIZE This Talk Twitter performance meltdown โ— Introduction to DTrace โ— DTrace on the case โ— Solutions and results โ— DTrace for your application โ— Q&A โ— 2
  • 3. USE IMPROVE EVANGELIZE What Is Twitter? Social networking/RSS/SMS โ— Ruby on Rails application โ— Horizontally scaled โ— Centralized MySQL backend โ— 3
  • 4. USE IMPROVE EVANGELIZE Twitter's Problem Started with a few users โ— Didn't scale with their success โ— High latencies could make it unusable โ— Many possible suspects: โ— The OS: kernel, libraries, etc. โ€“ Ruby, MySQL, Apache โ€“ The Twitter application itself โ€“ 4
  • 5. USE IMPROVE EVANGELIZE Enter DTrace Luckily: Twitter had DTrace โ— Solaris 10, Mac OS X 10.5, FreeBSD* โ€“ Systemic observability โ— Ruby, Java, JavaScript, C/C++, kernel ... โ€“ Concise answers to arbitrary questions โ— Designed for production systems โ— Architected to always be safe โ€“ No overhead when not in use โ€“ Also great for developers โ— 5
  • 6. USE IMPROVE EVANGELIZE DEMO 6
  • 7. USE IMPROVE EVANGELIZE The Investigation High latencies under load โ— What could cause these latencies? โ— on-CPU time: slow/numerous functions, ... โ€“ off-CPU time: I/O, lock contention, ... โ€“ 7
  • 8. USE IMPROVE EVANGELIZE DEMO 8
  • 9. USE IMPROVE EVANGELIZE Investigation: Steps 1. Started with a broad look at the system using familiar tools mpstat, ... โ— 2. DTrace profiling to sample processes 3. DTrace profiling to sample user stacks 9
  • 10. USE IMPROVE EVANGELIZE Investigation: So Far What we knew: โ— High application latency (from somewhere) โ€“ What we learned: โ— Latency may be due to high CPU load โ€“ CPU load is due to some Ruby component: โ€“ Twitter application โ— Standard Ruby libraries โ— Interpreter itself โ— 10
  • 11. USE IMPROVE EVANGELIZE DEMO 11
  • 12. USE IMPROVE EVANGELIZE Investigation: Steps 4. Function call counts 5. ustack() for memcpy() 6. Time spent in backtrace() What we learned: โ— 40% of CPU time spent in backtrace() โ€“ 12
  • 13. USE IMPROVE EVANGELIZE DEMO 13
  • 14. USE IMPROVE EVANGELIZE Investigation: Steps 7. Located source of backtrace() calls in Ruby code What we learned: โ— Several instances of code like this: โ€“ @string = (str.string rescue str) 14
  • 15. USE IMPROVE EVANGELIZE Results: No Exceptions Rather than blithely calling the method: โ— @string = (str.string rescue str) ... check first: โ— @string = str.responds_to?(:string) ? str.string : str Result: 30% drop in CPU utilization โ— 15
  • 16. USE IMPROVE EVANGELIZE Ruby Provider Joyent built DTrace-enabled Ruby โ— Trace function entry and return โ— Probes for line execution, memory โ— allocation, etc. 16
  • 17. USE IMPROVE EVANGELIZE DEMO 17
  • 18. USE IMPROVE EVANGELIZE Results: CRC32 in C Precision optimization โ— Rewrite the CRC32 computation in C โ— Estimated result: 15% drop in CPU โ— utilization 18
  • 19. USE IMPROVE EVANGELIZE DTrace Your Application Get your application on an OS with โ— DTrace Start with the tools you know and dive โ— deeper with DTrace If you can do it today or tomorrow, find โ— Adam and Brendan: we'll help you investigate DTrace sees all โ— 19
  • 20. USE IMPROVE EVANGELIZE Q&A (and links) DTrace home page โ€“ http://www.opensolaris.org/os/community/dtrace โ— DTrace-enabled Ruby โ€“ http://dtrace.joyent.com โ— Getting started with DTrace โ€“ http://blogs.sun.com/ahl/entry/dtrace_boot_camp โ— Exception problem: โ€“ http://dev.rubyonrails.org/ticket/8159 โ— http://dev.rubyonrails.org/changeset/6571 โ— Joyent's blog post on this subject โ€“ http://joyeur.com/2007/04/24/solaris-dtrace-and-rails 20 โ—
  • 21. USE IMPROVE EVANGELIZE Observability Matters: How DTrace Helped Twitter Adam Leventhal http://blogs.sun.com/ahl Brendan Gregg http://blogs.sun.com/brendan