SlideShare a Scribd company logo
1 of 120
Download to read offline
Tuesday, November 23, 2010
Rubinius
                 What have you done for me today?



Tuesday, November 23, 2010
Rubinius?


Tuesday, November 23, 2010
Rubinius
              Modern Ruby Implementation




Tuesday, November 23, 2010
Rubinius
                              Philosophy




Tuesday, November 23, 2010
Rubinius
                              Philosophy
                               Use Ruby




Tuesday, November 23, 2010
Rubinius
                                     Philosophy
                             Allow Ruby to extend the system




Tuesday, November 23, 2010
module Enumerable
                 def map
                   if block_given?
                     ary = []
                     each { |o| ary << yield(o) }
                     ary
                   else
                     to_a
                   end
                 end
               end


Tuesday, November 23, 2010
Rubinius
                             Compatibility
                                 1.8.7




Tuesday, November 23, 2010
Rubinius
                             Compatibility
                              Rails 2.3 - 3+




Tuesday, November 23, 2010
Rubinius
                             Compatibility
                              C extensions




Tuesday, November 23, 2010
Rubinius
                             Spin Off Projects




Tuesday, November 23, 2010
Rubinius
                             Spin Off Projects
                                 RubySpec




Tuesday, November 23, 2010
Rubinius
                             Spin Off Projects
                                    FFI




Tuesday, November 23, 2010
Rubinius
                             Drop In Compatible




Tuesday, November 23, 2010
Rubinius
                              Technology




Tuesday, November 23, 2010
Rubinius
                                 Technology
                             Bring techniques to Ruby




Tuesday, November 23, 2010
Tuesday, November 23, 2010
Optimized to
                             Machine Code




Tuesday, November 23, 2010
Optimized to
                             Machine Code

      Bytecode VM




Tuesday, November 23, 2010
Optimized to
                                        Machine Code

      Bytecode VM

                             Soph"ticated Garba# Collection




Tuesday, November 23, 2010
Rubinius
                                 Technology
                             Efficient Memory Layout




Tuesday, November 23, 2010
obj.ivars = {
                               :@name => “Evan”,
                               :@age => 31
                             }




Tuesday, November 23, 2010
obj.class.ivars = {
                               :@name => 0,
                               :@age => 1
                             }
                               obj.ivars = [
                                 “Evan”,
                                 31
                               ]




Tuesday, November 23, 2010
Flags

                               Class

                             Extra Ivars

                              @name

                               @age




Tuesday, November 23, 2010
Developers!


Tuesday, November 23, 2010
Developers!
                               Developers!




Tuesday, November 23, 2010
Developers!
                               Developers!
                                Developers!




Tuesday, November 23, 2010
API Driven
                             Build tools around APIs




Tuesday, November 23, 2010
API Driven
                     Allow users to build more!




Tuesday, November 23, 2010
API Driven
                                 Example
                              Bytecode Compiler




Tuesday, November 23, 2010
API Driven
                                  Example
                             Bytecode and Compiler




Tuesday, November 23, 2010
API Driven
                                Example
                               Fancy Language




Tuesday, November 23, 2010
Why use
                             Rubinius?

Tuesday, November 23, 2010
Why?
                             Focus on Developers




Tuesday, November 23, 2010
Why?
                             I’m a Ruby developer




Tuesday, November 23, 2010
Why?
                             Tools born from need




Tuesday, November 23, 2010
Problem:
                             Improve an Algorithm




Tuesday, November 23, 2010
Improving
                                Step 1




Tuesday, November 23, 2010
Improving
                                Step 1
                               Benchmark




Tuesday, November 23, 2010
require 'benchmark'
           cc = CoworkersCode.new

           Benchmark.bm do |x|
             x.report("initial") {
               cc.calculate_awesome_score
             }
           end




Tuesday, November 23, 2010
user      system      total        real
     initial                 0.071788    0.001601   0.073389 ( 29.998823)




Tuesday, November 23, 2010
29.998823

Tuesday, November 23, 2010
user      system      total        real
     initial                 0.071788    0.001601   0.073389 ( 29.998823)




Tuesday, November 23, 2010
user: 0.071788
                         system: 0.001601
                          total: 0.073389
                           real: 29.998823




Tuesday, November 23, 2010
User
                             Time running code




Tuesday, November 23, 2010
System
                             Time inside the kernel




Tuesday, November 23, 2010
Total
                             Sum of user and system




Tuesday, November 23, 2010
Real
                             Elapsed wall clock time




Tuesday, November 23, 2010
Wall Clock
          Time measured by a stop watch




Tuesday, November 23, 2010
user: 0.071788
                         system: 0.001601
                          total: 0.073389
                           real: 29.998823




Tuesday, November 23, 2010
0.073389

                                !=
                             29.998823




Tuesday, November 23, 2010
??
                             0.073389

                                !=
                             29.998823




Tuesday, November 23, 2010
Improving
                                Step 2
                                Profile




Tuesday, November 23, 2010
» rbx -Xprofile scratch/profile_sample.rb




  %    cumulative  self                self     total
 time    seconds  seconds      calls ms/call ms/call name
------------------------------------------------------------
  99.69    30.00    30.00         10 3000.10 3000.10 Rubinius::Channel#receive_timeout
    0.13    0.04     0.04          2    19.82    19.82 IO.open_with_mode
    0.11    0.03     0.03          1    33.05    33.05 IO::Buffer#fill
    0.02    0.01     0.01         18     0.30     0.30 FFI::Platform::POSIX.stat




Tuesday, November 23, 2010
» rbx -Xprofile scratch/profile_sample.rb




  %    cumulative  self                self     total
 time    seconds  seconds      calls ms/call ms/call name
------------------------------------------------------------
  99.69    30.00    30.00         10 3000.10 3000.10 Rubinius::Channel#receive_timeout
    0.13    0.04     0.04          2    19.82    19.82 IO.open_with_mode
    0.11    0.03     0.03          1    33.05    33.05 IO::Buffer#fill
    0.02    0.01     0.01         18     0.30     0.30 FFI::Platform::POSIX.stat




Tuesday, November 23, 2010
» rbx -Xprofile scratch/profile_sample.rb




  %    cumulative  self                self     total
 time    seconds  seconds      calls ms/call ms/call name
------------------------------------------------------------
  99.69    30.00    30.00         10 3000.10 3000.10 Rubinius::Channel#receive_timeout
    0.13    0.04     0.04          2    19.82    19.82 IO.open_with_mode
    0.11    0.03     0.03          1    33.05    33.05 IO::Buffer#fill
    0.02    0.01     0.01         18     0.30     0.30 FFI::Platform::POSIX.stat




Tuesday, November 23, 2010
» rbx -Xprofile scratch/profile_sample.rb




  %    cumulative  self                self     total
 time    seconds  seconds      calls ms/call ms/call name
------------------------------------------------------------
  99.69    30.00    30.00         10 3000.10 3000.10 Rubinius::Channel#receive_timeout
    0.13    0.04     0.04          2    19.82    19.82 IO.open_with_mode
    0.11    0.03     0.03          1    33.05    33.05 IO::Buffer#fill
    0.02    0.01     0.01         18     0.30     0.30 FFI::Platform::POSIX.stat




Tuesday, November 23, 2010
» rbx -Xprofile -Xprofiler.graph scratch/profile_sample.rb




Tuesday, November 23, 2010
» rbx -Xprofile -Xprofiler.graph scratch/profile_sample.rb




Tuesday, November 23, 2010
» rbx -Xprofile -Xprofiler.graph scratch/profile_sample.rb

                         0.00   30.00   10/60        Kernel#sleep [15]
[16]        99.9        30.00    0.00   10      Rubinius::Channel#receive_timeout [16]




Tuesday, November 23, 2010
» rbx -Xprofile -Xprofiler.graph scratch/profile_sample.rb

                         0.00   30.00   10/60        Kernel#sleep [15]
[16]        99.9        30.00    0.00   10      Rubinius::Channel#receive_timeout [16]




                         0.00   30.00   10/20        CoworkersCode#superhero_factor [14]
[15]        99.9         0.00   30.00   10      Kernel#sleep [15]
                        30.00    0.00   10/10        Rubinius::Channel#receive_timeout [16]




Tuesday, November 23, 2010
» rbx -Xprofile -Xprofiler.graph scratch/profile_sample.rb

                         0.00   30.00   10/60        Kernel#sleep [15]
[16]        99.9        30.00    0.00   10      Rubinius::Channel#receive_timeout [16]




                         0.00   30.00   10/20        CoworkersCode#superhero_factor [14]
[15]        99.9         0.00   30.00   10      Kernel#sleep [15]
                        30.00    0.00   10/10        Rubinius::Channel#receive_timeout [16]




Tuesday, November 23, 2010
» rbx -Xprofile -Xprofiler.graph scratch/profile_sample.rb

                         0.00   30.00   10/60        Kernel#sleep [15]
[16]        99.9        30.00    0.00   10      Rubinius::Channel#receive_timeout [16]




                         0.00   30.00   10/20        CoworkersCode#superhero_factor [14]
[15]        99.9         0.00   30.00   10      Kernel#sleep [15]
                        30.00    0.00   10/10        Rubinius::Channel#receive_timeout [16]




Tuesday, November 23, 2010
def superhero_factor
                               sleep 3
                               rand(10)
                             end




Tuesday, November 23, 2010
def superhero_factor
                               sleep 3
                               rand(10)
                             end




Tuesday, November 23, 2010
Improving
                                  Step 3
                              Fix and benchmark




Tuesday, November 23, 2010
user      system      total         real
     initial                 0.000102    0.000047   0.000149 (   0.000139)




Tuesday, November 23, 2010
0.000139

Tuesday, November 23, 2010
0.000139

Tuesday, November 23, 2010
0.073389

                                !=
                             29.998823




Tuesday, November 23, 2010
Sleep!
                      Invisible in all but real time




Tuesday, November 23, 2010
Problem:
                             Improve an Algorithm




Tuesday, November 23, 2010
E D !
                               Problem:
                       O LV
                     S       Improve an Algorithm




Tuesday, November 23, 2010
Problem:
                             Slow / hung process




Tuesday, November 23, 2010
» bin/rbx scratch/qa_sample.rb
      1288125364.684678: Server started, pid 39331




Tuesday, November 23, 2010
Problem:
                             Slow / hung process
                             Use Query Agent to inspect




Tuesday, November 23, 2010
» bin/rbx -Xagent.start scratch/qa_sample.rb
      1288125364.684678: Server started, pid 39331




Tuesday, November 23, 2010
» bin/rbx -Xagent.start scratch/qa_sample.rb
      1288125364.684678: Server started, pid 39331




Tuesday, November 23, 2010
» bin/rbx console
    VM: bin/rbx -Xagent.start scratch/qa_sample.rb
    Connecting to VM on port 58273
    Connected to localhost:58273, host type: x86_64-apple-darwin10.4.0
    console>




Tuesday, November 23, 2010
» bin/rbx console
    VM: bin/rbx -Xagent.start scratch/qa_sample.rb
    Connecting to VM on port 58273
    Connected to localhost:58273, host type: x86_64-apple-darwin10.4.0
    console> pid
    PID: 39331




Tuesday, November 23, 2010
» bin/rbx -Xagent.start scratch/qa_sample.rb
      1288125364.684678: Server started, pid 39331




Tuesday, November 23, 2010
» bin/rbx console
    VM: bin/rbx -Xagent.start scratch/qa_sample.rb
    Connecting to VM on port 58273
    Connected to localhost:58273, host type: x86_64-apple-darwin10.4.0
    console> pid
    PID: 39331
    console> backtrace




Tuesday, November 23, 2010
» bin/rbx console
    VM: bin/rbx -Xagent.start scratch/qa_sample.rb
    Connecting to VM on port 58273
    Connected to localhost:58273, host type: x86_64-apple-darwin10.4.0
    console> pid
    PID: 39331
    console> backtrace
    Thread 0:
    0x7fff5fbfc250: IO::Buffer#fill_from in kernel/common/io.rb:67 (+72)
    0x7fff5fbfc690: IO#read in kernel/common/io.rb:1197 (+125)
    0x7fff5fbfcaf0: ImportantServer#get_request in /Users/evan/git/rbx-
    release/scratch/qa_sample.rb:10 (+7)
    0x7fff5fbfced0: MAIN.__script__ in /Users/evan/git/rbx-release/
    scratch/qa_sample.rb:17 (+91)
    0x7fff5fbfd390: Rubinius::CodeLoader#load_script in kernel/delta/
    codeloader.rb:67 (+44)
    0x7fff5fbfd790: Rubinius::CodeLoader.load_script in kernel/delta/
    codeloader.rb:91 (+40)
    0x7fff5fbfdbb0: Rubinius::Loader#script in kernel/loader.rb:467 (+125
    0x7fff5fbfdfc0: Rubinius::Loader#main in kernel/loader.rb:578 (+64)
    0x7fff5fbfe3e0: Rubinius::Loader.main in kernel/loader.rb:617 (+33)
    0x7fff5fbfe800: Object#__script__ in kernel/loader.rb:628 (+60)


Tuesday, November 23, 2010
Thread 0:
    0x7fff5fbfc250: IO::Buffer#fill_from in kernel/common/io.rb:67 (+72)
    0x7fff5fbfc690: IO#read in kernel/common/io.rb:1197 (+125)
    0x7fff5fbfcaf0: ImportantServer#get_request in /Users/evan/git/rbx-
    release/scratch/qa_sample.rb:10 (+7)
    0x7fff5fbfced0: MAIN.__script__ in /Users/evan/git/rbx-release/
    scratch/qa_sample.rb:17 (+91)
    0x7fff5fbfd390: Rubinius::CodeLoader#load_script in kernel/delta/
    codeloader.rb:67 (+44)
    0x7fff5fbfd790: Rubinius::CodeLoader.load_script in kernel/delta/
    codeloader.rb:91 (+40)
    0x7fff5fbfdbb0: Rubinius::Loader#script in kernel/loader.rb:467 (+125
    0x7fff5fbfdfc0: Rubinius::Loader#main in kernel/loader.rb:578 (+64)
    0x7fff5fbfe3e0: Rubinius::Loader.main in kernel/loader.rb:617 (+33)
    0x7fff5fbfe800: Object#__script__ in kernel/loader.rb:628 (+60)




Tuesday, November 23, 2010
Thread 0:
    0x7fff5fbfc250: IO::Buffer#fill_from in kernel/common/io.rb:67 (+72)
    0x7fff5fbfc690: IO#read in kernel/common/io.rb:1197 (+125)
    0x7fff5fbfcaf0: ImportantServer#get_request in /Users/evan/git/rbx-
    release/scratch/qa_sample.rb:10 (+7)
    0x7fff5fbfced0: MAIN.__script__ in /Users/evan/git/rbx-release/
    scratch/qa_sample.rb:17 (+91)
    0x7fff5fbfd390: Rubinius::CodeLoader#load_script in kernel/delta/
    codeloader.rb:67 (+44)
    0x7fff5fbfd790: Rubinius::CodeLoader.load_script in kernel/delta/
    codeloader.rb:91 (+40)
    0x7fff5fbfdbb0: Rubinius::Loader#script in kernel/loader.rb:467 (+125
    0x7fff5fbfdfc0: Rubinius::Loader#main in kernel/loader.rb:578 (+64)
    0x7fff5fbfe3e0: Rubinius::Loader.main in kernel/loader.rb:617 (+33)
    0x7fff5fbfe800: Object#__script__ in kernel/loader.rb:628 (+60)




Tuesday, November 23, 2010
Problem:
                             Slow / hung process
                              Sample process via CLI




Tuesday, November 23, 2010
» bin/rbx -Xagent.start -Xagent.verbose 
          scratch/qa_sample.rb
      [QA: Bound to port 58407]
      1288125364.684678: Server started, pid 39331




Tuesday, November 23, 2010
» bin/rbx -Xagent.start -Xagent.verbose 
          scratch/qa_sample.rb
      [QA: Bound to port 58407]
      1288125364.684678: Server started, pid 39331




Tuesday, November 23, 2010
» bin/rbx -Xagent.start -Xagent.verbose 
          scratch/qa_sample.rb
      [QA: Bound to port 58407]
      1288125364.684678: Server started, pid 39331




Tuesday, November 23, 2010
» bin/rbx console -p 58431 --bt
  Thread 0:
  0x7fff5fbfc200: IO::Buffer#fill_from in kernel/common/io.rb:67 (+72)
  0x7fff5fbfc640: IO#read in kernel/common/io.rb:1197 (+125)
  0x7fff5fbfcaa0: ImportantServer#get_request in /Users/evan/git/rbx-
  release/scratch/qa_sample.rb:10 (+7)
  0x7fff5fbfce80: MAIN.__script__ in /Users/evan/git/rbx-release/
  scratch/qa_sample.rb:17 (+91)
  0x7fff5fbfd340: Rubinius::CodeLoader#load_script in kernel/delta/
  codeloader.rb:67 (+44)
  0x7fff5fbfd740: Rubinius::CodeLoader.load_script in kernel/delta/
  codeloader.rb:91 (+40)
  0x7fff5fbfdb60: Rubinius::Loader#script in kernel/loader.rb:467 (+125)
  0x7fff5fbfdf70: Rubinius::Loader#main in kernel/loader.rb:578 (+64)
  0x7fff5fbfe390: Rubinius::Loader.main in kernel/loader.rb:617 (+33)
  0x7fff5fbfe7b0: Object#__script__ in kernel/loader.rb:628 (+60)




Tuesday, November 23, 2010
Problem:
                             Slow / hung process
                         Easy API to build monitoring tools




Tuesday, November 23, 2010
require 'socket'
   require 'rubinius/agent'
   port = 58431
   agent = Rubinius::Agent.connect(
            "localhost", port)
   kind, bt = agent.get("system.backtrace")




Tuesday, November 23, 2010
Query Agent
                             Socket based VM API




Tuesday, November 23, 2010
Query Agent
                             Socket based VM API
                              Simple get/set variables




Tuesday, November 23, 2010
Problem:
                             Slow / hung process




Tuesday, November 23, 2010
E D !
                              Problem:
                       O LV
                     S       Slow / hung process




Tuesday, November 23, 2010
Problem:
                             Memory Footprint




Tuesday, November 23, 2010
Problem:
                             Memory Footprint
                        Suspect some kind of memory leak




Tuesday, November 23, 2010
Problem:
                             Memory Footprint
                               Use Heap Dump!




Tuesday, November 23, 2010
» bin/rbx -Xagent.start scratch/hd_demo.rb
       Waiting...




Tuesday, November 23, 2010
» bin/rbx console
       VM: bin/rbx -Xagent.start scratch/hd_demo.rb
       Connecting to VM on port 58710
       Connected to localhost:58710, host type:
       x86_64-apple-darwin10.4.0
       console> set system.memory.dump heap.dump




Tuesday, November 23, 2010
» bin/rbx -Xagent.start scratch/hd_demo.rb
       Waiting...
       Heap dumped to heap.dump




Tuesday, November 23, 2010
» rbx -Ilib           histo.rb ../rbx-release/heap.dump
            19798                          Rubinius::Tuple 3487912
             4867            Rubinius::MethodTable::Bucket 272552
             4218                                   String 303696
             4193                 Rubinius::CompiledMethod 805056
             4193            Rubinius::InstructionSequence 134176
             4110                      Rubinius::ByteArray 100199256
             1547            Rubinius::LookupTable::Bucket 74256
             1053                    Rubinius::LookupTable 50544
             1010                    Rubinius::MethodTable 48480
             1000                            BigCrazyClass 32000
              966                                    Class 104592
              783                    Rubinius::StaticScope 37584
              704                 Rubinius::AccessVariable 56320




Tuesday, November 23, 2010
» rbx -Ilib           histo.rb ../rbx-release/heap.dump
            19798                          Rubinius::Tuple 3487912
             4867            Rubinius::MethodTable::Bucket 272552
             4218                                   String 303696
             4193                 Rubinius::CompiledMethod 805056
             4193            Rubinius::InstructionSequence 134176
             4110                      Rubinius::ByteArray 100199256
             1547            Rubinius::LookupTable::Bucket 74256
             1053                    Rubinius::LookupTable 50544
             1010                    Rubinius::MethodTable 48480
             1000                            BigCrazyClass 32000
              966                                    Class 104592
              783                    Rubinius::StaticScope 37584
              704                 Rubinius::AccessVariable 56320




Tuesday, November 23, 2010
Heap Dump
                             Complete Heap Layout




Tuesday, November 23, 2010
Heap Dump
                             Complete Heap Layout
                                  Stable format




Tuesday, November 23, 2010
Heap Dump
                             Complete Heap Layout
                               Reference Ruby Reader




Tuesday, November 23, 2010
Heap Dump
                                Gauge




Tuesday, November 23, 2010
Heap Dump
                                     Gauge
                             Rails Application Explorer




Tuesday, November 23, 2010
Heap Dump
                               Future Feature
                              Tracking allocation sites




Tuesday, November 23, 2010
Problem:
                             Memory Footprint




Tuesday, November 23, 2010
E D !
                             Problem:
                       O LV
                     S       Memory Footprint




Tuesday, November 23, 2010
Dy)
                           Eostl !
                             Problem:
                       O LV(m
                     S       Memory Footprint




Tuesday, November 23, 2010
Future


Tuesday, November 23, 2010
Future
                               1.9




Tuesday, November 23, 2010
Future
                             Windows




Tuesday, November 23, 2010
Future
                             Full Concurrency




Tuesday, November 23, 2010
Why Not?


Tuesday, November 23, 2010
Thanks!


Tuesday, November 23, 2010

More Related Content

Similar to Rubinius - What Have You Done For Me Lately

Rubinius - What Have You Done For Me Lately?
Rubinius - What Have You Done For Me Lately?Rubinius - What Have You Done For Me Lately?
Rubinius - What Have You Done For Me Lately?evanphx
 
Designing With Type :: FontConf 2010
Designing With Type :: FontConf 2010Designing With Type :: FontConf 2010
Designing With Type :: FontConf 2010Kyle Meyer
 
Clojure in the Field
Clojure in the FieldClojure in the Field
Clojure in the FieldAaron Bedra
 
Using email keynote 2010
Using email keynote 2010Using email keynote 2010
Using email keynote 2010Danuta W-Piwko
 
School governors and online collaboration
School governors and online collaborationSchool governors and online collaboration
School governors and online collaborationDave Briggs
 
The Public Sector Learning Community
The Public Sector Learning CommunityThe Public Sector Learning Community
The Public Sector Learning CommunityPaul McElvaney
 
Doing Horrible Things to DNS in the Name of Science - SF Performance Meetup
Doing Horrible Things to DNS in the Name of Science - SF Performance MeetupDoing Horrible Things to DNS in the Name of Science - SF Performance Meetup
Doing Horrible Things to DNS in the Name of Science - SF Performance MeetupTom Croucher
 
MongoDB is the new MySQL
MongoDB is the new MySQLMongoDB is the new MySQL
MongoDB is the new MySQLradamanthus
 
Developing in HTML5: Widgetbox & Sencha Touch
Developing in HTML5: Widgetbox & Sencha TouchDeveloping in HTML5: Widgetbox & Sencha Touch
Developing in HTML5: Widgetbox & Sencha TouchSencha
 
Community in action leroy merlin case study - nuxeo world 2010
Community in action   leroy merlin case study - nuxeo world 2010Community in action   leroy merlin case study - nuxeo world 2010
Community in action leroy merlin case study - nuxeo world 2010Nuxeo
 
RubyConf UY 2010
RubyConf UY 2010RubyConf UY 2010
RubyConf UY 2010Brian Ford
 

Similar to Rubinius - What Have You Done For Me Lately (14)

Rubinius - What Have You Done For Me Lately?
Rubinius - What Have You Done For Me Lately?Rubinius - What Have You Done For Me Lately?
Rubinius - What Have You Done For Me Lately?
 
Designing With Type :: FontConf 2010
Designing With Type :: FontConf 2010Designing With Type :: FontConf 2010
Designing With Type :: FontConf 2010
 
Clojure in the Field
Clojure in the FieldClojure in the Field
Clojure in the Field
 
Open business helsingborg (10 09-2010)
Open business helsingborg (10 09-2010)Open business helsingborg (10 09-2010)
Open business helsingborg (10 09-2010)
 
Using email keynote 2010
Using email keynote 2010Using email keynote 2010
Using email keynote 2010
 
School governors and online collaboration
School governors and online collaborationSchool governors and online collaboration
School governors and online collaboration
 
The Public Sector Learning Community
The Public Sector Learning CommunityThe Public Sector Learning Community
The Public Sector Learning Community
 
Doing Horrible Things to DNS in the Name of Science - SF Performance Meetup
Doing Horrible Things to DNS in the Name of Science - SF Performance MeetupDoing Horrible Things to DNS in the Name of Science - SF Performance Meetup
Doing Horrible Things to DNS in the Name of Science - SF Performance Meetup
 
Sf perf
Sf perfSf perf
Sf perf
 
MongoDB is the new MySQL
MongoDB is the new MySQLMongoDB is the new MySQL
MongoDB is the new MySQL
 
Developing in HTML5: Widgetbox & Sencha Touch
Developing in HTML5: Widgetbox & Sencha TouchDeveloping in HTML5: Widgetbox & Sencha Touch
Developing in HTML5: Widgetbox & Sencha Touch
 
CSS3 now
CSS3 nowCSS3 now
CSS3 now
 
Community in action leroy merlin case study - nuxeo world 2010
Community in action   leroy merlin case study - nuxeo world 2010Community in action   leroy merlin case study - nuxeo world 2010
Community in action leroy merlin case study - nuxeo world 2010
 
RubyConf UY 2010
RubyConf UY 2010RubyConf UY 2010
RubyConf UY 2010
 

More from evanphx

Rubinius For You - GoRuCo
Rubinius For You - GoRuCoRubinius For You - GoRuCo
Rubinius For You - GoRuCoevanphx
 
Developing a Language
Developing a LanguageDeveloping a Language
Developing a Languageevanphx
 
Staking Your Claim In Open Source
Staking Your Claim In Open SourceStaking Your Claim In Open Source
Staking Your Claim In Open Sourceevanphx
 
RubyConf 2009
RubyConf 2009RubyConf 2009
RubyConf 2009evanphx
 
Accelerating Ruby with LLVM
Accelerating Ruby with LLVMAccelerating Ruby with LLVM
Accelerating Ruby with LLVMevanphx
 
Rubinius Community - MWRC
Rubinius Community - MWRCRubinius Community - MWRC
Rubinius Community - MWRCevanphx
 
rubyconf 2007 - Rubinius 1.0
rubyconf 2007 - Rubinius 1.0rubyconf 2007 - Rubinius 1.0
rubyconf 2007 - Rubinius 1.0evanphx
 
Rubinius - Improving the Rails ecosystem
Rubinius - Improving the Rails ecosystemRubinius - Improving the Rails ecosystem
Rubinius - Improving the Rails ecosystemevanphx
 
Rubinius - A Tool of the Future
Rubinius - A Tool of the FutureRubinius - A Tool of the Future
Rubinius - A Tool of the Futureevanphx
 

More from evanphx (9)

Rubinius For You - GoRuCo
Rubinius For You - GoRuCoRubinius For You - GoRuCo
Rubinius For You - GoRuCo
 
Developing a Language
Developing a LanguageDeveloping a Language
Developing a Language
 
Staking Your Claim In Open Source
Staking Your Claim In Open SourceStaking Your Claim In Open Source
Staking Your Claim In Open Source
 
RubyConf 2009
RubyConf 2009RubyConf 2009
RubyConf 2009
 
Accelerating Ruby with LLVM
Accelerating Ruby with LLVMAccelerating Ruby with LLVM
Accelerating Ruby with LLVM
 
Rubinius Community - MWRC
Rubinius Community - MWRCRubinius Community - MWRC
Rubinius Community - MWRC
 
rubyconf 2007 - Rubinius 1.0
rubyconf 2007 - Rubinius 1.0rubyconf 2007 - Rubinius 1.0
rubyconf 2007 - Rubinius 1.0
 
Rubinius - Improving the Rails ecosystem
Rubinius - Improving the Rails ecosystemRubinius - Improving the Rails ecosystem
Rubinius - Improving the Rails ecosystem
 
Rubinius - A Tool of the Future
Rubinius - A Tool of the FutureRubinius - A Tool of the Future
Rubinius - A Tool of the Future
 

Recently uploaded

Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptxJoelynRubio1
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptNishitharanjan Rout
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsNbelano25
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17Celine George
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 

Recently uploaded (20)

Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 

Rubinius - What Have You Done For Me Lately

  • 2. Rubinius What have you done for me today? Tuesday, November 23, 2010
  • 4. Rubinius Modern Ruby Implementation Tuesday, November 23, 2010
  • 5. Rubinius Philosophy Tuesday, November 23, 2010
  • 6. Rubinius Philosophy Use Ruby Tuesday, November 23, 2010
  • 7. Rubinius Philosophy Allow Ruby to extend the system Tuesday, November 23, 2010
  • 8. module Enumerable def map if block_given? ary = [] each { |o| ary << yield(o) } ary else to_a end end end Tuesday, November 23, 2010
  • 9. Rubinius Compatibility 1.8.7 Tuesday, November 23, 2010
  • 10. Rubinius Compatibility Rails 2.3 - 3+ Tuesday, November 23, 2010
  • 11. Rubinius Compatibility C extensions Tuesday, November 23, 2010
  • 12. Rubinius Spin Off Projects Tuesday, November 23, 2010
  • 13. Rubinius Spin Off Projects RubySpec Tuesday, November 23, 2010
  • 14. Rubinius Spin Off Projects FFI Tuesday, November 23, 2010
  • 15. Rubinius Drop In Compatible Tuesday, November 23, 2010
  • 16. Rubinius Technology Tuesday, November 23, 2010
  • 17. Rubinius Technology Bring techniques to Ruby Tuesday, November 23, 2010
  • 19. Optimized to Machine Code Tuesday, November 23, 2010
  • 20. Optimized to Machine Code Bytecode VM Tuesday, November 23, 2010
  • 21. Optimized to Machine Code Bytecode VM Soph"ticated Garba# Collection Tuesday, November 23, 2010
  • 22. Rubinius Technology Efficient Memory Layout Tuesday, November 23, 2010
  • 23. obj.ivars = { :@name => “Evan”, :@age => 31 } Tuesday, November 23, 2010
  • 24. obj.class.ivars = { :@name => 0, :@age => 1 } obj.ivars = [ “Evan”, 31 ] Tuesday, November 23, 2010
  • 25. Flags Class Extra Ivars @name @age Tuesday, November 23, 2010
  • 27. Developers! Developers! Tuesday, November 23, 2010
  • 28. Developers! Developers! Developers! Tuesday, November 23, 2010
  • 29. API Driven Build tools around APIs Tuesday, November 23, 2010
  • 30. API Driven Allow users to build more! Tuesday, November 23, 2010
  • 31. API Driven Example Bytecode Compiler Tuesday, November 23, 2010
  • 32. API Driven Example Bytecode and Compiler Tuesday, November 23, 2010
  • 33. API Driven Example Fancy Language Tuesday, November 23, 2010
  • 34. Why use Rubinius? Tuesday, November 23, 2010
  • 35. Why? Focus on Developers Tuesday, November 23, 2010
  • 36. Why? I’m a Ruby developer Tuesday, November 23, 2010
  • 37. Why? Tools born from need Tuesday, November 23, 2010
  • 38. Problem: Improve an Algorithm Tuesday, November 23, 2010
  • 39. Improving Step 1 Tuesday, November 23, 2010
  • 40. Improving Step 1 Benchmark Tuesday, November 23, 2010
  • 41. require 'benchmark' cc = CoworkersCode.new Benchmark.bm do |x| x.report("initial") { cc.calculate_awesome_score } end Tuesday, November 23, 2010
  • 42. user system total real initial 0.071788 0.001601 0.073389 ( 29.998823) Tuesday, November 23, 2010
  • 44. user system total real initial 0.071788 0.001601 0.073389 ( 29.998823) Tuesday, November 23, 2010
  • 45. user: 0.071788 system: 0.001601 total: 0.073389 real: 29.998823 Tuesday, November 23, 2010
  • 46. User Time running code Tuesday, November 23, 2010
  • 47. System Time inside the kernel Tuesday, November 23, 2010
  • 48. Total Sum of user and system Tuesday, November 23, 2010
  • 49. Real Elapsed wall clock time Tuesday, November 23, 2010
  • 50. Wall Clock Time measured by a stop watch Tuesday, November 23, 2010
  • 51. user: 0.071788 system: 0.001601 total: 0.073389 real: 29.998823 Tuesday, November 23, 2010
  • 52. 0.073389 != 29.998823 Tuesday, November 23, 2010
  • 53. ?? 0.073389 != 29.998823 Tuesday, November 23, 2010
  • 54. Improving Step 2 Profile Tuesday, November 23, 2010
  • 55. » rbx -Xprofile scratch/profile_sample.rb % cumulative self self total time seconds seconds calls ms/call ms/call name ------------------------------------------------------------ 99.69 30.00 30.00 10 3000.10 3000.10 Rubinius::Channel#receive_timeout 0.13 0.04 0.04 2 19.82 19.82 IO.open_with_mode 0.11 0.03 0.03 1 33.05 33.05 IO::Buffer#fill 0.02 0.01 0.01 18 0.30 0.30 FFI::Platform::POSIX.stat Tuesday, November 23, 2010
  • 56. » rbx -Xprofile scratch/profile_sample.rb % cumulative self self total time seconds seconds calls ms/call ms/call name ------------------------------------------------------------ 99.69 30.00 30.00 10 3000.10 3000.10 Rubinius::Channel#receive_timeout 0.13 0.04 0.04 2 19.82 19.82 IO.open_with_mode 0.11 0.03 0.03 1 33.05 33.05 IO::Buffer#fill 0.02 0.01 0.01 18 0.30 0.30 FFI::Platform::POSIX.stat Tuesday, November 23, 2010
  • 57. » rbx -Xprofile scratch/profile_sample.rb % cumulative self self total time seconds seconds calls ms/call ms/call name ------------------------------------------------------------ 99.69 30.00 30.00 10 3000.10 3000.10 Rubinius::Channel#receive_timeout 0.13 0.04 0.04 2 19.82 19.82 IO.open_with_mode 0.11 0.03 0.03 1 33.05 33.05 IO::Buffer#fill 0.02 0.01 0.01 18 0.30 0.30 FFI::Platform::POSIX.stat Tuesday, November 23, 2010
  • 58. » rbx -Xprofile scratch/profile_sample.rb % cumulative self self total time seconds seconds calls ms/call ms/call name ------------------------------------------------------------ 99.69 30.00 30.00 10 3000.10 3000.10 Rubinius::Channel#receive_timeout 0.13 0.04 0.04 2 19.82 19.82 IO.open_with_mode 0.11 0.03 0.03 1 33.05 33.05 IO::Buffer#fill 0.02 0.01 0.01 18 0.30 0.30 FFI::Platform::POSIX.stat Tuesday, November 23, 2010
  • 59. » rbx -Xprofile -Xprofiler.graph scratch/profile_sample.rb Tuesday, November 23, 2010
  • 60. » rbx -Xprofile -Xprofiler.graph scratch/profile_sample.rb Tuesday, November 23, 2010
  • 61. » rbx -Xprofile -Xprofiler.graph scratch/profile_sample.rb 0.00 30.00 10/60 Kernel#sleep [15] [16] 99.9 30.00 0.00 10 Rubinius::Channel#receive_timeout [16] Tuesday, November 23, 2010
  • 62. » rbx -Xprofile -Xprofiler.graph scratch/profile_sample.rb 0.00 30.00 10/60 Kernel#sleep [15] [16] 99.9 30.00 0.00 10 Rubinius::Channel#receive_timeout [16] 0.00 30.00 10/20 CoworkersCode#superhero_factor [14] [15] 99.9 0.00 30.00 10 Kernel#sleep [15] 30.00 0.00 10/10 Rubinius::Channel#receive_timeout [16] Tuesday, November 23, 2010
  • 63. » rbx -Xprofile -Xprofiler.graph scratch/profile_sample.rb 0.00 30.00 10/60 Kernel#sleep [15] [16] 99.9 30.00 0.00 10 Rubinius::Channel#receive_timeout [16] 0.00 30.00 10/20 CoworkersCode#superhero_factor [14] [15] 99.9 0.00 30.00 10 Kernel#sleep [15] 30.00 0.00 10/10 Rubinius::Channel#receive_timeout [16] Tuesday, November 23, 2010
  • 64. » rbx -Xprofile -Xprofiler.graph scratch/profile_sample.rb 0.00 30.00 10/60 Kernel#sleep [15] [16] 99.9 30.00 0.00 10 Rubinius::Channel#receive_timeout [16] 0.00 30.00 10/20 CoworkersCode#superhero_factor [14] [15] 99.9 0.00 30.00 10 Kernel#sleep [15] 30.00 0.00 10/10 Rubinius::Channel#receive_timeout [16] Tuesday, November 23, 2010
  • 65. def superhero_factor sleep 3 rand(10) end Tuesday, November 23, 2010
  • 66. def superhero_factor sleep 3 rand(10) end Tuesday, November 23, 2010
  • 67. Improving Step 3 Fix and benchmark Tuesday, November 23, 2010
  • 68. user system total real initial 0.000102 0.000047 0.000149 ( 0.000139) Tuesday, November 23, 2010
  • 71. 0.073389 != 29.998823 Tuesday, November 23, 2010
  • 72. Sleep! Invisible in all but real time Tuesday, November 23, 2010
  • 73. Problem: Improve an Algorithm Tuesday, November 23, 2010
  • 74. E D ! Problem: O LV S Improve an Algorithm Tuesday, November 23, 2010
  • 75. Problem: Slow / hung process Tuesday, November 23, 2010
  • 76. » bin/rbx scratch/qa_sample.rb 1288125364.684678: Server started, pid 39331 Tuesday, November 23, 2010
  • 77. Problem: Slow / hung process Use Query Agent to inspect Tuesday, November 23, 2010
  • 78. » bin/rbx -Xagent.start scratch/qa_sample.rb 1288125364.684678: Server started, pid 39331 Tuesday, November 23, 2010
  • 79. » bin/rbx -Xagent.start scratch/qa_sample.rb 1288125364.684678: Server started, pid 39331 Tuesday, November 23, 2010
  • 80. » bin/rbx console VM: bin/rbx -Xagent.start scratch/qa_sample.rb Connecting to VM on port 58273 Connected to localhost:58273, host type: x86_64-apple-darwin10.4.0 console> Tuesday, November 23, 2010
  • 81. » bin/rbx console VM: bin/rbx -Xagent.start scratch/qa_sample.rb Connecting to VM on port 58273 Connected to localhost:58273, host type: x86_64-apple-darwin10.4.0 console> pid PID: 39331 Tuesday, November 23, 2010
  • 82. » bin/rbx -Xagent.start scratch/qa_sample.rb 1288125364.684678: Server started, pid 39331 Tuesday, November 23, 2010
  • 83. » bin/rbx console VM: bin/rbx -Xagent.start scratch/qa_sample.rb Connecting to VM on port 58273 Connected to localhost:58273, host type: x86_64-apple-darwin10.4.0 console> pid PID: 39331 console> backtrace Tuesday, November 23, 2010
  • 84. » bin/rbx console VM: bin/rbx -Xagent.start scratch/qa_sample.rb Connecting to VM on port 58273 Connected to localhost:58273, host type: x86_64-apple-darwin10.4.0 console> pid PID: 39331 console> backtrace Thread 0: 0x7fff5fbfc250: IO::Buffer#fill_from in kernel/common/io.rb:67 (+72) 0x7fff5fbfc690: IO#read in kernel/common/io.rb:1197 (+125) 0x7fff5fbfcaf0: ImportantServer#get_request in /Users/evan/git/rbx- release/scratch/qa_sample.rb:10 (+7) 0x7fff5fbfced0: MAIN.__script__ in /Users/evan/git/rbx-release/ scratch/qa_sample.rb:17 (+91) 0x7fff5fbfd390: Rubinius::CodeLoader#load_script in kernel/delta/ codeloader.rb:67 (+44) 0x7fff5fbfd790: Rubinius::CodeLoader.load_script in kernel/delta/ codeloader.rb:91 (+40) 0x7fff5fbfdbb0: Rubinius::Loader#script in kernel/loader.rb:467 (+125 0x7fff5fbfdfc0: Rubinius::Loader#main in kernel/loader.rb:578 (+64) 0x7fff5fbfe3e0: Rubinius::Loader.main in kernel/loader.rb:617 (+33) 0x7fff5fbfe800: Object#__script__ in kernel/loader.rb:628 (+60) Tuesday, November 23, 2010
  • 85. Thread 0: 0x7fff5fbfc250: IO::Buffer#fill_from in kernel/common/io.rb:67 (+72) 0x7fff5fbfc690: IO#read in kernel/common/io.rb:1197 (+125) 0x7fff5fbfcaf0: ImportantServer#get_request in /Users/evan/git/rbx- release/scratch/qa_sample.rb:10 (+7) 0x7fff5fbfced0: MAIN.__script__ in /Users/evan/git/rbx-release/ scratch/qa_sample.rb:17 (+91) 0x7fff5fbfd390: Rubinius::CodeLoader#load_script in kernel/delta/ codeloader.rb:67 (+44) 0x7fff5fbfd790: Rubinius::CodeLoader.load_script in kernel/delta/ codeloader.rb:91 (+40) 0x7fff5fbfdbb0: Rubinius::Loader#script in kernel/loader.rb:467 (+125 0x7fff5fbfdfc0: Rubinius::Loader#main in kernel/loader.rb:578 (+64) 0x7fff5fbfe3e0: Rubinius::Loader.main in kernel/loader.rb:617 (+33) 0x7fff5fbfe800: Object#__script__ in kernel/loader.rb:628 (+60) Tuesday, November 23, 2010
  • 86. Thread 0: 0x7fff5fbfc250: IO::Buffer#fill_from in kernel/common/io.rb:67 (+72) 0x7fff5fbfc690: IO#read in kernel/common/io.rb:1197 (+125) 0x7fff5fbfcaf0: ImportantServer#get_request in /Users/evan/git/rbx- release/scratch/qa_sample.rb:10 (+7) 0x7fff5fbfced0: MAIN.__script__ in /Users/evan/git/rbx-release/ scratch/qa_sample.rb:17 (+91) 0x7fff5fbfd390: Rubinius::CodeLoader#load_script in kernel/delta/ codeloader.rb:67 (+44) 0x7fff5fbfd790: Rubinius::CodeLoader.load_script in kernel/delta/ codeloader.rb:91 (+40) 0x7fff5fbfdbb0: Rubinius::Loader#script in kernel/loader.rb:467 (+125 0x7fff5fbfdfc0: Rubinius::Loader#main in kernel/loader.rb:578 (+64) 0x7fff5fbfe3e0: Rubinius::Loader.main in kernel/loader.rb:617 (+33) 0x7fff5fbfe800: Object#__script__ in kernel/loader.rb:628 (+60) Tuesday, November 23, 2010
  • 87. Problem: Slow / hung process Sample process via CLI Tuesday, November 23, 2010
  • 88. » bin/rbx -Xagent.start -Xagent.verbose scratch/qa_sample.rb [QA: Bound to port 58407] 1288125364.684678: Server started, pid 39331 Tuesday, November 23, 2010
  • 89. » bin/rbx -Xagent.start -Xagent.verbose scratch/qa_sample.rb [QA: Bound to port 58407] 1288125364.684678: Server started, pid 39331 Tuesday, November 23, 2010
  • 90. » bin/rbx -Xagent.start -Xagent.verbose scratch/qa_sample.rb [QA: Bound to port 58407] 1288125364.684678: Server started, pid 39331 Tuesday, November 23, 2010
  • 91. » bin/rbx console -p 58431 --bt Thread 0: 0x7fff5fbfc200: IO::Buffer#fill_from in kernel/common/io.rb:67 (+72) 0x7fff5fbfc640: IO#read in kernel/common/io.rb:1197 (+125) 0x7fff5fbfcaa0: ImportantServer#get_request in /Users/evan/git/rbx- release/scratch/qa_sample.rb:10 (+7) 0x7fff5fbfce80: MAIN.__script__ in /Users/evan/git/rbx-release/ scratch/qa_sample.rb:17 (+91) 0x7fff5fbfd340: Rubinius::CodeLoader#load_script in kernel/delta/ codeloader.rb:67 (+44) 0x7fff5fbfd740: Rubinius::CodeLoader.load_script in kernel/delta/ codeloader.rb:91 (+40) 0x7fff5fbfdb60: Rubinius::Loader#script in kernel/loader.rb:467 (+125) 0x7fff5fbfdf70: Rubinius::Loader#main in kernel/loader.rb:578 (+64) 0x7fff5fbfe390: Rubinius::Loader.main in kernel/loader.rb:617 (+33) 0x7fff5fbfe7b0: Object#__script__ in kernel/loader.rb:628 (+60) Tuesday, November 23, 2010
  • 92. Problem: Slow / hung process Easy API to build monitoring tools Tuesday, November 23, 2010
  • 93. require 'socket' require 'rubinius/agent' port = 58431 agent = Rubinius::Agent.connect( "localhost", port) kind, bt = agent.get("system.backtrace") Tuesday, November 23, 2010
  • 94. Query Agent Socket based VM API Tuesday, November 23, 2010
  • 95. Query Agent Socket based VM API Simple get/set variables Tuesday, November 23, 2010
  • 96. Problem: Slow / hung process Tuesday, November 23, 2010
  • 97. E D ! Problem: O LV S Slow / hung process Tuesday, November 23, 2010
  • 98. Problem: Memory Footprint Tuesday, November 23, 2010
  • 99. Problem: Memory Footprint Suspect some kind of memory leak Tuesday, November 23, 2010
  • 100. Problem: Memory Footprint Use Heap Dump! Tuesday, November 23, 2010
  • 101. » bin/rbx -Xagent.start scratch/hd_demo.rb Waiting... Tuesday, November 23, 2010
  • 102. » bin/rbx console VM: bin/rbx -Xagent.start scratch/hd_demo.rb Connecting to VM on port 58710 Connected to localhost:58710, host type: x86_64-apple-darwin10.4.0 console> set system.memory.dump heap.dump Tuesday, November 23, 2010
  • 103. » bin/rbx -Xagent.start scratch/hd_demo.rb Waiting... Heap dumped to heap.dump Tuesday, November 23, 2010
  • 104. » rbx -Ilib histo.rb ../rbx-release/heap.dump 19798 Rubinius::Tuple 3487912 4867 Rubinius::MethodTable::Bucket 272552 4218 String 303696 4193 Rubinius::CompiledMethod 805056 4193 Rubinius::InstructionSequence 134176 4110 Rubinius::ByteArray 100199256 1547 Rubinius::LookupTable::Bucket 74256 1053 Rubinius::LookupTable 50544 1010 Rubinius::MethodTable 48480 1000 BigCrazyClass 32000 966 Class 104592 783 Rubinius::StaticScope 37584 704 Rubinius::AccessVariable 56320 Tuesday, November 23, 2010
  • 105. » rbx -Ilib histo.rb ../rbx-release/heap.dump 19798 Rubinius::Tuple 3487912 4867 Rubinius::MethodTable::Bucket 272552 4218 String 303696 4193 Rubinius::CompiledMethod 805056 4193 Rubinius::InstructionSequence 134176 4110 Rubinius::ByteArray 100199256 1547 Rubinius::LookupTable::Bucket 74256 1053 Rubinius::LookupTable 50544 1010 Rubinius::MethodTable 48480 1000 BigCrazyClass 32000 966 Class 104592 783 Rubinius::StaticScope 37584 704 Rubinius::AccessVariable 56320 Tuesday, November 23, 2010
  • 106. Heap Dump Complete Heap Layout Tuesday, November 23, 2010
  • 107. Heap Dump Complete Heap Layout Stable format Tuesday, November 23, 2010
  • 108. Heap Dump Complete Heap Layout Reference Ruby Reader Tuesday, November 23, 2010
  • 109. Heap Dump Gauge Tuesday, November 23, 2010
  • 110. Heap Dump Gauge Rails Application Explorer Tuesday, November 23, 2010
  • 111. Heap Dump Future Feature Tracking allocation sites Tuesday, November 23, 2010
  • 112. Problem: Memory Footprint Tuesday, November 23, 2010
  • 113. E D ! Problem: O LV S Memory Footprint Tuesday, November 23, 2010
  • 114. Dy) Eostl ! Problem: O LV(m S Memory Footprint Tuesday, November 23, 2010
  • 116. Future 1.9 Tuesday, November 23, 2010
  • 117. Future Windows Tuesday, November 23, 2010
  • 118. Future Full Concurrency Tuesday, November 23, 2010