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




...
module Enumerable
                 def map
                   if block_given?
                     ary = []
              ...
Rubinius
                             Compatibility
                                 1.8.7




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




Tuesday, November 23,...
Rubinius
                             Compatibility
                              C extensions




Tuesday, November 23, 2...
Rubinius
                             Spin Off Projects




Tuesday, November 23, 2010
Rubinius
                             Spin Off Projects
                                 RubySpec




Tuesday, November 23...
Rubinius
                             Spin Off Projects
                                    FFI




Tuesday, November 23, ...
Rubinius
                             Drop In Compatible




Tuesday, November 23, 2010
Rubinius
                              Technology




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




Tuesday, No...
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"ti...
Rubinius
                                 Technology
                             Efficient Memory Layout




Tuesday, Nove...
obj.ivars = {
                               :@name => “Evan”,
                               :@age => 31
                ...
obj.class.ivars = {
                               :@name => 0,
                               :@age => 1
                ...
Flags

                               Class

                             Extra Ivars

                              @name...
Developers!


Tuesday, November 23, 2010
Developers!
                               Developers!




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




Tuesday, November 2...
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 ...
API Driven
                                  Example
                             Bytecode and Compiler




Tuesday, Novem...
API Driven
                                Example
                               Fancy Language




Tuesday, November 23,...
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") {
 ...
user      system      total        real
     initial                 0.071788    0.001601   0.073389 ( 29.998823)




Tues...
29.998823

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




Tues...
user: 0.071788
                         system: 0.001601
                          total: 0.073389
                       ...
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
                       ...
0.073389

                                !=
                             29.998823




Tuesday, November 23, 2010
??
                             0.073389

                                !=
                             29.998823




Tu...
Improving
                                Step 2
                                Profile




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




  %    cumulative  self                self     total
 time    seconds  seco...
» rbx -Xprofile scratch/profile_sample.rb




  %    cumulative  self                self     total
 time    seconds  seco...
» rbx -Xprofile scratch/profile_sample.rb




  %    cumulative  self                self     total
 time    seconds  seco...
» rbx -Xprofile scratch/profile_sample.rb




  %    cumulative  self                self     total
 time    seconds  seco...
» 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#sl...
» rbx -Xprofile -Xprofiler.graph scratch/profile_sample.rb

                         0.00   30.00   10/60        Kernel#sl...
» rbx -Xprofile -Xprofiler.graph scratch/profile_sample.rb

                         0.00   30.00   10/60        Kernel#sl...
» rbx -Xprofile -Xprofiler.graph scratch/profile_sample.rb

                         0.00   30.00   10/60        Kernel#sl...
def superhero_factor
                               sleep 3
                               rand(10)
                      ...
def superhero_factor
                               sleep 3
                               rand(10)
                      ...
Improving
                                  Step 3
                              Fix and benchmark




Tuesday, November 2...
user      system      total         real
     initial                 0.000102    0.000047   0.000149 (   0.000139)




Tu...
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 Algorith...
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




Tues...
» bin/rbx -Xagent.start scratch/qa_sample.rb
      1288125364.684678: Server started, pid 39331




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




Tuesday, November 23, ...
» bin/rbx console
    VM: bin/rbx -Xagent.start scratch/qa_sample.rb
    Connecting to VM on port 58273
    Connected to l...
» bin/rbx console
    VM: bin/rbx -Xagent.start scratch/qa_sample.rb
    Connecting to VM on port 58273
    Connected to l...
» bin/rbx -Xagent.start scratch/qa_sample.rb
      1288125364.684678: Server started, pid 39331




Tuesday, November 23, ...
» bin/rbx console
    VM: bin/rbx -Xagent.start scratch/qa_sample.rb
    Connecting to VM on port 58273
    Connected to l...
» bin/rbx console
    VM: bin/rbx -Xagent.start scratch/qa_sample.rb
    Connecting to VM on port 58273
    Connected to l...
Thread 0:
    0x7fff5fbfc250: IO::Buffer#fill_from in kernel/common/io.rb:67 (+72)
    0x7fff5fbfc690: IO#read in kernel/c...
Thread 0:
    0x7fff5fbfc250: IO::Buffer#fill_from in kernel/common/io.rb:67 (+72)
    0x7fff5fbfc690: IO#read in kernel/c...
Problem:
                             Slow / hung process
                              Sample process via CLI




Tuesday...
» bin/rbx -Xagent.start -Xagent.verbose 
          scratch/qa_sample.rb
      [QA: Bound to port 58407]
      1288125364.6...
» bin/rbx -Xagent.start -Xagent.verbose 
          scratch/qa_sample.rb
      [QA: Bound to port 58407]
      1288125364.6...
» bin/rbx -Xagent.start -Xagent.verbose 
          scratch/qa_sample.rb
      [QA: Bound to port 58407]
      1288125364.6...
» bin/rbx console -p 58431 --bt
  Thread 0:
  0x7fff5fbfc200: IO::Buffer#fill_from in kernel/common/io.rb:67 (+72)
  0x7ff...
Problem:
                             Slow / hung process
                         Easy API to build monitoring tools




...
require 'socket'
   require 'rubinius/agent'
   port = 58431
   agent = Rubinius::Agent.connect(
            "localhost", ...
Query Agent
                             Socket based VM API




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




Tu...
Problem:
                             Slow / hung process




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




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




Tuesda...
Problem:
                             Memory Footprint
                               Use Heap Dump!




Tuesday, November...
» 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
       Connect...
» 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...
» rbx -Ilib           histo.rb ../rbx-release/heap.dump
            19798                          Rubinius::Tuple 3487912...
Heap Dump
                             Complete Heap Layout




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




Tuesday, N...
Heap Dump
                             Complete Heap Layout
                               Reference Ruby Reader




Tuesd...
Heap Dump
                                Gauge




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




Tuesday, ...
Heap Dump
                               Future Feature
                              Tracking allocation sites




Tuesda...
Problem:
                             Memory Footprint




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




...
Dy)
                           Eostl !
                             Problem:
                       O LV(m
               ...
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
Upcoming SlideShare
Loading in …5
×

Rubinius - What Have You Done For Me Lately

2,389 views

Published on

Talk given at RubyConf 2010 in New Orleans by Evan Phoenix on Rubinius.

Published in: Education, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,389
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
23
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Rubinius - What Have You Done For Me Lately

  1. 1. Tuesday, November 23, 2010
  2. 2. Rubinius What have you done for me today? Tuesday, November 23, 2010
  3. 3. Rubinius? Tuesday, November 23, 2010
  4. 4. Rubinius Modern Ruby Implementation Tuesday, November 23, 2010
  5. 5. Rubinius Philosophy Tuesday, November 23, 2010
  6. 6. Rubinius Philosophy Use Ruby Tuesday, November 23, 2010
  7. 7. Rubinius Philosophy Allow Ruby to extend the system Tuesday, November 23, 2010
  8. 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. 9. Rubinius Compatibility 1.8.7 Tuesday, November 23, 2010
  10. 10. Rubinius Compatibility Rails 2.3 - 3+ Tuesday, November 23, 2010
  11. 11. Rubinius Compatibility C extensions Tuesday, November 23, 2010
  12. 12. Rubinius Spin Off Projects Tuesday, November 23, 2010
  13. 13. Rubinius Spin Off Projects RubySpec Tuesday, November 23, 2010
  14. 14. Rubinius Spin Off Projects FFI Tuesday, November 23, 2010
  15. 15. Rubinius Drop In Compatible Tuesday, November 23, 2010
  16. 16. Rubinius Technology Tuesday, November 23, 2010
  17. 17. Rubinius Technology Bring techniques to Ruby Tuesday, November 23, 2010
  18. 18. Tuesday, November 23, 2010
  19. 19. Optimized to Machine Code Tuesday, November 23, 2010
  20. 20. Optimized to Machine Code Bytecode VM Tuesday, November 23, 2010
  21. 21. Optimized to Machine Code Bytecode VM Soph"ticated Garba# Collection Tuesday, November 23, 2010
  22. 22. Rubinius Technology Efficient Memory Layout Tuesday, November 23, 2010
  23. 23. obj.ivars = { :@name => “Evan”, :@age => 31 } Tuesday, November 23, 2010
  24. 24. obj.class.ivars = { :@name => 0, :@age => 1 } obj.ivars = [ “Evan”, 31 ] Tuesday, November 23, 2010
  25. 25. Flags Class Extra Ivars @name @age Tuesday, November 23, 2010
  26. 26. Developers! Tuesday, November 23, 2010
  27. 27. Developers! Developers! Tuesday, November 23, 2010
  28. 28. Developers! Developers! Developers! Tuesday, November 23, 2010
  29. 29. API Driven Build tools around APIs Tuesday, November 23, 2010
  30. 30. API Driven Allow users to build more! Tuesday, November 23, 2010
  31. 31. API Driven Example Bytecode Compiler Tuesday, November 23, 2010
  32. 32. API Driven Example Bytecode and Compiler Tuesday, November 23, 2010
  33. 33. API Driven Example Fancy Language Tuesday, November 23, 2010
  34. 34. Why use Rubinius? Tuesday, November 23, 2010
  35. 35. Why? Focus on Developers Tuesday, November 23, 2010
  36. 36. Why? I’m a Ruby developer Tuesday, November 23, 2010
  37. 37. Why? Tools born from need Tuesday, November 23, 2010
  38. 38. Problem: Improve an Algorithm Tuesday, November 23, 2010
  39. 39. Improving Step 1 Tuesday, November 23, 2010
  40. 40. Improving Step 1 Benchmark Tuesday, November 23, 2010
  41. 41. require 'benchmark' cc = CoworkersCode.new Benchmark.bm do |x| x.report("initial") { cc.calculate_awesome_score } end Tuesday, November 23, 2010
  42. 42. user system total real initial 0.071788 0.001601 0.073389 ( 29.998823) Tuesday, November 23, 2010
  43. 43. 29.998823 Tuesday, November 23, 2010
  44. 44. user system total real initial 0.071788 0.001601 0.073389 ( 29.998823) Tuesday, November 23, 2010
  45. 45. user: 0.071788 system: 0.001601 total: 0.073389 real: 29.998823 Tuesday, November 23, 2010
  46. 46. User Time running code Tuesday, November 23, 2010
  47. 47. System Time inside the kernel Tuesday, November 23, 2010
  48. 48. Total Sum of user and system Tuesday, November 23, 2010
  49. 49. Real Elapsed wall clock time Tuesday, November 23, 2010
  50. 50. Wall Clock Time measured by a stop watch Tuesday, November 23, 2010
  51. 51. user: 0.071788 system: 0.001601 total: 0.073389 real: 29.998823 Tuesday, November 23, 2010
  52. 52. 0.073389 != 29.998823 Tuesday, November 23, 2010
  53. 53. ?? 0.073389 != 29.998823 Tuesday, November 23, 2010
  54. 54. Improving Step 2 Profile Tuesday, November 23, 2010
  55. 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. 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. 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. 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. 59. » rbx -Xprofile -Xprofiler.graph scratch/profile_sample.rb Tuesday, November 23, 2010
  60. 60. » rbx -Xprofile -Xprofiler.graph scratch/profile_sample.rb Tuesday, November 23, 2010
  61. 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. 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. 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. 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. 65. def superhero_factor sleep 3 rand(10) end Tuesday, November 23, 2010
  66. 66. def superhero_factor sleep 3 rand(10) end Tuesday, November 23, 2010
  67. 67. Improving Step 3 Fix and benchmark Tuesday, November 23, 2010
  68. 68. user system total real initial 0.000102 0.000047 0.000149 ( 0.000139) Tuesday, November 23, 2010
  69. 69. 0.000139 Tuesday, November 23, 2010
  70. 70. 0.000139 Tuesday, November 23, 2010
  71. 71. 0.073389 != 29.998823 Tuesday, November 23, 2010
  72. 72. Sleep! Invisible in all but real time Tuesday, November 23, 2010
  73. 73. Problem: Improve an Algorithm Tuesday, November 23, 2010
  74. 74. E D ! Problem: O LV S Improve an Algorithm Tuesday, November 23, 2010
  75. 75. Problem: Slow / hung process Tuesday, November 23, 2010
  76. 76. » bin/rbx scratch/qa_sample.rb 1288125364.684678: Server started, pid 39331 Tuesday, November 23, 2010
  77. 77. Problem: Slow / hung process Use Query Agent to inspect Tuesday, November 23, 2010
  78. 78. » bin/rbx -Xagent.start scratch/qa_sample.rb 1288125364.684678: Server started, pid 39331 Tuesday, November 23, 2010
  79. 79. » bin/rbx -Xagent.start scratch/qa_sample.rb 1288125364.684678: Server started, pid 39331 Tuesday, November 23, 2010
  80. 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. 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. 82. » bin/rbx -Xagent.start scratch/qa_sample.rb 1288125364.684678: Server started, pid 39331 Tuesday, November 23, 2010
  83. 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. 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. 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. 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. 87. Problem: Slow / hung process Sample process via CLI Tuesday, November 23, 2010
  88. 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. 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. 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. 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. 92. Problem: Slow / hung process Easy API to build monitoring tools Tuesday, November 23, 2010
  93. 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. 94. Query Agent Socket based VM API Tuesday, November 23, 2010
  95. 95. Query Agent Socket based VM API Simple get/set variables Tuesday, November 23, 2010
  96. 96. Problem: Slow / hung process Tuesday, November 23, 2010
  97. 97. E D ! Problem: O LV S Slow / hung process Tuesday, November 23, 2010
  98. 98. Problem: Memory Footprint Tuesday, November 23, 2010
  99. 99. Problem: Memory Footprint Suspect some kind of memory leak Tuesday, November 23, 2010
  100. 100. Problem: Memory Footprint Use Heap Dump! Tuesday, November 23, 2010
  101. 101. » bin/rbx -Xagent.start scratch/hd_demo.rb Waiting... Tuesday, November 23, 2010
  102. 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. 103. » bin/rbx -Xagent.start scratch/hd_demo.rb Waiting... Heap dumped to heap.dump Tuesday, November 23, 2010
  104. 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. 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. 106. Heap Dump Complete Heap Layout Tuesday, November 23, 2010
  107. 107. Heap Dump Complete Heap Layout Stable format Tuesday, November 23, 2010
  108. 108. Heap Dump Complete Heap Layout Reference Ruby Reader Tuesday, November 23, 2010
  109. 109. Heap Dump Gauge Tuesday, November 23, 2010
  110. 110. Heap Dump Gauge Rails Application Explorer Tuesday, November 23, 2010
  111. 111. Heap Dump Future Feature Tracking allocation sites Tuesday, November 23, 2010
  112. 112. Problem: Memory Footprint Tuesday, November 23, 2010
  113. 113. E D ! Problem: O LV S Memory Footprint Tuesday, November 23, 2010
  114. 114. Dy) Eostl ! Problem: O LV(m S Memory Footprint Tuesday, November 23, 2010
  115. 115. Future Tuesday, November 23, 2010
  116. 116. Future 1.9 Tuesday, November 23, 2010
  117. 117. Future Windows Tuesday, November 23, 2010
  118. 118. Future Full Concurrency Tuesday, November 23, 2010
  119. 119. Why Not? Tuesday, November 23, 2010
  120. 120. Thanks! Tuesday, November 23, 2010

×