SlideShare a Scribd company logo
1 of 39
Download to read offline
Improving the Rails
    ecosystem
   The Rubinius Virtual Machine




                1
Thanks EY!




    2
Be thinking of questions
a_better_ruby
     ==
a_better_rails
             # => true
Brand new code base
Write in ruby first.
       Then C if you have to.
If you’re not failing every now
and again, it’s a sign you’re not
doing anything very innovative.
                   Woody Allen
A work in progrees
Nov. 3: 1.0 preview
  End of 07: 1.0
You’re the customer
Help me help you.
Tell me your pain.
Some current pain
Memory usage


               Memory
• 1.8 garbage collector is simple, but too simple.
• Rubinius uses modern techniques to decrease
  memory usage and increase throughput




                                               Memory
                        15
The forking problem


                      Memory
In 1.8...

• Start up a mongrel.
• Require all your code.
• fork() the process.
• Watch your memory double.

                              Memory
                    17
In Rubinius...

• Start up a mongrel.
• Require all your code.
• fork() the process.
• Watch NO change in the memory footprint!

                                        Memory
                     18
Memory change per
          additional mongrel instance




1          2               3            4

    1.8                  rubinius
                 19
Packaging / Deployment
.rba == .jar
.rba == .war


                Packaging
• Precompiled code (.rbc)
• Meta data about project
  • RDoc
• Assets

                            Packaging
                      22
Performance
Built for change


                   Performance
Modern Techniques


• Inline caching
• Pre-compiled code
• JIT (eventually)

                           Performance
                      25
3 legged dog   turtles        space shuttle   rubinius
                                                Performance
                         26
Error reporting
Normal Backtraces

    An exception has occurred:
        User requested termination with Control-C (Interrupt)

    Backtrace:
            Readline.readline    at    kernel/core/readline.rb:52
               main.__script__   at    lib/bin/sirb.rb:78
                     main.load   at    kernel/core/compile.rb:78
                  main.require   at    kernel/core/compile.rb:129
                    Array#each   at    kernel/core/array.rb:526
        Integer(Fixnum)#times    at    kernel/core/integer.rb:19
                    Array#each   at    kernel/core/array.rb:526
                  main.require   at    kernel/core/compile.rb:112
                    Array#each   at    kernel/core/array.rb:526
        Integer(Fixnum)#times    at    kernel/core/integer.rb:19
                    Array#each   at    kernel/core/array.rb:526
                  main.require   at    kernel/core/compile.rb:111
               main.__script__   at    kernel/loader.rb:159
Reporting                             28
C extensions can
               misbehave


Reporting
VALUE test_segfault(VALUE self) {
                                // Get a pointer to address 4.
                                char *i = (char*)4;
                                // Attempt to read from address 4
                                // which is definitely not allowed.
                                x = *i;
                                // Never get this far.
                                return Qnil;
                              }

                       Raises an exception!
  Segfault detected in function 0x90a00 (accessing 0x4) (MemorySegmentionError)


   SomeExtension#test_segfault         at   extensions/test/test.c
               main.__script__         at   extensions/test/test.rb:38
                     main.load         at   kernel/core/compile.rb:95
               main.__script__         at   kernel/loader.rb:122



Reporting
Time lost to segfaults
                         (in minutes)


                   1.8                      rubinius
                                                           200
200


150


100
                                       70


 50       30

                                                           10
                                       6
          2


      1                            3                   5

                              31
Profiling
In 1.8...


• Profiling is instrumented only.
• The speed hit is prohibitive for running in
  production mode



                                                Profiling
                        33
In Rubinius...


• Sampling profiler available always
• Has little to no impact on performance


                                           Profiling
                      34
In my_app.rb
           require ‘simple_profile’

           profile(:profile1) do
             obj.run_slow_method
           end



shell# rbx profiler --analyze profile1.results


                                             Profiling
                        35
In environment.rb
      require ‘simple_profile’

      SimpleProfiler.profile_actions
      SimpleProfiler.profile_views



shell# rbx profiler --analyze actions.results
shell# rbx profiler --analyze views.results
                                                Profiling
                        36
Disclaimer
• All statements and numbers and opinions are
  only those of Evan Phoenix.

• All statistics are made up, but represent a
  general trend.




                        38
Evan Phoenix
    evan@fallingsnow.net
  ephoenix@engineyard.com




             39

More Related Content

Similar to Rubinius - Improving the Rails ecosystem

Rails Hardware (no conclusions!)
Rails Hardware (no conclusions!)Rails Hardware (no conclusions!)
Rails Hardware (no conclusions!)
yarry
 
Rails Application Optimization Techniques & Tools
Rails Application Optimization Techniques & ToolsRails Application Optimization Techniques & Tools
Rails Application Optimization Techniques & Tools
guest05c09d
 

Similar to Rubinius - Improving the Rails ecosystem (20)

Rocket Fuelled Cucumbers
Rocket Fuelled CucumbersRocket Fuelled Cucumbers
Rocket Fuelled Cucumbers
 
Rails Hardware (no conclusions!)
Rails Hardware (no conclusions!)Rails Hardware (no conclusions!)
Rails Hardware (no conclusions!)
 
Rails Application Optimization Techniques & Tools
Rails Application Optimization Techniques & ToolsRails Application Optimization Techniques & Tools
Rails Application Optimization Techniques & Tools
 
Ansible for Configuration Management for Lohika DevOps training 2018 @ Lohika...
Ansible for Configuration Management for Lohika DevOps training 2018 @ Lohika...Ansible for Configuration Management for Lohika DevOps training 2018 @ Lohika...
Ansible for Configuration Management for Lohika DevOps training 2018 @ Lohika...
 
There and Back Again
There and Back AgainThere and Back Again
There and Back Again
 
Ceph Day Melbourne - Troubleshooting Ceph
Ceph Day Melbourne - Troubleshooting Ceph Ceph Day Melbourne - Troubleshooting Ceph
Ceph Day Melbourne - Troubleshooting Ceph
 
Some Rough Fibrous Material
Some Rough Fibrous MaterialSome Rough Fibrous Material
Some Rough Fibrous Material
 
JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015
 
Valgrind
ValgrindValgrind
Valgrind
 
Scaling Django
Scaling DjangoScaling Django
Scaling Django
 
Redis ndc2013
Redis ndc2013Redis ndc2013
Redis ndc2013
 
Upgrading to Rails 3
Upgrading to Rails 3Upgrading to Rails 3
Upgrading to Rails 3
 
2011-03 Developing Windows Exploits
2011-03 Developing Windows Exploits 2011-03 Developing Windows Exploits
2011-03 Developing Windows Exploits
 
Basics_of_Kernel_Panic_Hang_and_ Kdump.pdf
Basics_of_Kernel_Panic_Hang_and_ Kdump.pdfBasics_of_Kernel_Panic_Hang_and_ Kdump.pdf
Basics_of_Kernel_Panic_Hang_and_ Kdump.pdf
 
Kernel Recipes 2019 - BPF at Facebook
Kernel Recipes 2019 - BPF at FacebookKernel Recipes 2019 - BPF at Facebook
Kernel Recipes 2019 - BPF at Facebook
 
2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...
2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...
2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...
 
Next Stop, Android
Next Stop, AndroidNext Stop, Android
Next Stop, Android
 
NSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
NSC #2 - D3 02 - Peter Hlavaty - Attack on the CoreNSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
NSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
 
introduction-infra-as-a-code using terraform
introduction-infra-as-a-code using terraformintroduction-infra-as-a-code using terraform
introduction-infra-as-a-code using terraform
 
C++ in kernel mode
C++ in kernel modeC++ in kernel mode
C++ in kernel mode
 

More from evanphx

Rubinius Community - MWRC
Rubinius Community - MWRCRubinius Community - MWRC
Rubinius Community - MWRC
evanphx
 

More from evanphx (12)

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
 
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
Rubinius - What Have You Done For Me LatelyRubinius - What Have You Done For Me Lately
Rubinius - What Have You Done For Me Lately
 
Staking Your Claim In Open Source
Staking Your Claim In Open SourceStaking Your Claim In Open Source
Staking Your Claim In Open Source
 
Rubinius 1.0 and more!
Rubinius 1.0 and more!Rubinius 1.0 and more!
Rubinius 1.0 and more!
 
RubyConf 2009
RubyConf 2009RubyConf 2009
RubyConf 2009
 
Accelerating Ruby with LLVM
Accelerating Ruby with LLVMAccelerating Ruby with LLVM
Accelerating Ruby with LLVM
 
Ruby World
Ruby WorldRuby World
Ruby World
 
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 - A Tool of the Future
Rubinius - A Tool of the FutureRubinius - A Tool of the Future
Rubinius - A Tool of the Future
 

Recently uploaded

unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabiunwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
Abortion pills in Kuwait Cytotec pills in Kuwait
 
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
dlhescort
 
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai KuwaitThe Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
daisycvs
 
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
amitlee9823
 
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
amitlee9823
 
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
amitlee9823
 
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
daisycvs
 
Call Girls In Noida 959961⊹3876 Independent Escort Service Noida
Call Girls In Noida 959961⊹3876 Independent Escort Service NoidaCall Girls In Noida 959961⊹3876 Independent Escort Service Noida
Call Girls In Noida 959961⊹3876 Independent Escort Service Noida
dlhescort
 

Recently uploaded (20)

Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
Organizational Transformation Lead with Culture
Organizational Transformation Lead with CultureOrganizational Transformation Lead with Culture
Organizational Transformation Lead with Culture
 
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabiunwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
 
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
 
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai KuwaitThe Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
 
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRLBAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
 
PHX May 2024 Corporate Presentation Final
PHX May 2024 Corporate Presentation FinalPHX May 2024 Corporate Presentation Final
PHX May 2024 Corporate Presentation Final
 
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
 
Marel Q1 2024 Investor Presentation from May 8, 2024
Marel Q1 2024 Investor Presentation from May 8, 2024Marel Q1 2024 Investor Presentation from May 8, 2024
Marel Q1 2024 Investor Presentation from May 8, 2024
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
 
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...
👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...
👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...
 
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1
 
How to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League CityHow to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League City
 
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
 
Call Girls In Noida 959961⊹3876 Independent Escort Service Noida
Call Girls In Noida 959961⊹3876 Independent Escort Service NoidaCall Girls In Noida 959961⊹3876 Independent Escort Service Noida
Call Girls In Noida 959961⊹3876 Independent Escort Service Noida
 
RSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors DataRSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors Data
 
Cheap Rate Call Girls In Noida Sector 62 Metro 959961乂3876
Cheap Rate Call Girls In Noida Sector 62 Metro 959961乂3876Cheap Rate Call Girls In Noida Sector 62 Metro 959961乂3876
Cheap Rate Call Girls In Noida Sector 62 Metro 959961乂3876
 
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
 

Rubinius - Improving the Rails ecosystem

  • 1. Improving the Rails ecosystem The Rubinius Virtual Machine 1
  • 3. Be thinking of questions
  • 4. a_better_ruby == a_better_rails # => true
  • 6. Write in ruby first. Then C if you have to.
  • 7. If you’re not failing every now and again, it’s a sign you’re not doing anything very innovative. Woody Allen
  • 8. A work in progrees
  • 9. Nov. 3: 1.0 preview End of 07: 1.0
  • 12. Tell me your pain.
  • 14. Memory usage Memory
  • 15. • 1.8 garbage collector is simple, but too simple. • Rubinius uses modern techniques to decrease memory usage and increase throughput Memory 15
  • 17. In 1.8... • Start up a mongrel. • Require all your code. • fork() the process. • Watch your memory double. Memory 17
  • 18. In Rubinius... • Start up a mongrel. • Require all your code. • fork() the process. • Watch NO change in the memory footprint! Memory 18
  • 19. Memory change per additional mongrel instance 1 2 3 4 1.8 rubinius 19
  • 21. .rba == .jar .rba == .war Packaging
  • 22. • Precompiled code (.rbc) • Meta data about project • RDoc • Assets Packaging 22
  • 24. Built for change Performance
  • 25. Modern Techniques • Inline caching • Pre-compiled code • JIT (eventually) Performance 25
  • 26. 3 legged dog turtles space shuttle rubinius Performance 26
  • 28. Normal Backtraces An exception has occurred: User requested termination with Control-C (Interrupt) Backtrace: Readline.readline at kernel/core/readline.rb:52 main.__script__ at lib/bin/sirb.rb:78 main.load at kernel/core/compile.rb:78 main.require at kernel/core/compile.rb:129 Array#each at kernel/core/array.rb:526 Integer(Fixnum)#times at kernel/core/integer.rb:19 Array#each at kernel/core/array.rb:526 main.require at kernel/core/compile.rb:112 Array#each at kernel/core/array.rb:526 Integer(Fixnum)#times at kernel/core/integer.rb:19 Array#each at kernel/core/array.rb:526 main.require at kernel/core/compile.rb:111 main.__script__ at kernel/loader.rb:159 Reporting 28
  • 29. C extensions can misbehave Reporting
  • 30. VALUE test_segfault(VALUE self) { // Get a pointer to address 4. char *i = (char*)4; // Attempt to read from address 4 // which is definitely not allowed. x = *i; // Never get this far. return Qnil; } Raises an exception! Segfault detected in function 0x90a00 (accessing 0x4) (MemorySegmentionError) SomeExtension#test_segfault at extensions/test/test.c main.__script__ at extensions/test/test.rb:38 main.load at kernel/core/compile.rb:95 main.__script__ at kernel/loader.rb:122 Reporting
  • 31. Time lost to segfaults (in minutes) 1.8 rubinius 200 200 150 100 70 50 30 10 6 2 1 3 5 31
  • 33. In 1.8... • Profiling is instrumented only. • The speed hit is prohibitive for running in production mode Profiling 33
  • 34. In Rubinius... • Sampling profiler available always • Has little to no impact on performance Profiling 34
  • 35. In my_app.rb require ‘simple_profile’ profile(:profile1) do obj.run_slow_method end shell# rbx profiler --analyze profile1.results Profiling 35
  • 36. In environment.rb require ‘simple_profile’ SimpleProfiler.profile_actions SimpleProfiler.profile_views shell# rbx profiler --analyze actions.results shell# rbx profiler --analyze views.results Profiling 36
  • 38. • All statements and numbers and opinions are only those of Evan Phoenix. • All statistics are made up, but represent a general trend. 38
  • 39. Evan Phoenix evan@fallingsnow.net ephoenix@engineyard.com 39