SlideShare uma empresa Scribd logo
1 de 39
Baixar para ler 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

Mais conteúdo relacionado

Semelhante a 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
 

Semelhante a 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
 

Mais de evanphx

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

Mais de 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
 

Último

Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al MizharAl Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
allensay1
 
Jual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan Cytotec
Jual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan CytotecJual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan Cytotec
Jual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan Cytotec
ZurliaSoop
 
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in OmanMifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
instagramfab782445
 
!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...
!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...
!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...
DUBAI (+971)581248768 BUY ABORTION PILLS IN ABU dhabi...Qatar
 

Último (20)

Organizational Transformation Lead with Culture
Organizational Transformation Lead with CultureOrganizational Transformation Lead with Culture
Organizational Transformation Lead with Culture
 
Falcon Invoice Discounting: Aviate Your Cash Flow Challenges
Falcon Invoice Discounting: Aviate Your Cash Flow ChallengesFalcon Invoice Discounting: Aviate Your Cash Flow Challenges
Falcon Invoice Discounting: Aviate Your Cash Flow Challenges
 
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
 
Cracking the 'Career Pathing' Slideshare
Cracking the 'Career Pathing' SlideshareCracking the 'Career Pathing' Slideshare
Cracking the 'Career Pathing' Slideshare
 
Call 7737669865 Vadodara Call Girls Service at your Door Step Available All Time
Call 7737669865 Vadodara Call Girls Service at your Door Step Available All TimeCall 7737669865 Vadodara Call Girls Service at your Door Step Available All Time
Call 7737669865 Vadodara Call Girls Service at your Door Step Available All Time
 
PHX May 2024 Corporate Presentation Final
PHX May 2024 Corporate Presentation FinalPHX May 2024 Corporate Presentation Final
PHX May 2024 Corporate Presentation Final
 
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al MizharAl Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
 
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
 
TVB_The Vietnam Believer Newsletter_May 6th, 2024_ENVol. 006.pdf
TVB_The Vietnam Believer Newsletter_May 6th, 2024_ENVol. 006.pdfTVB_The Vietnam Believer Newsletter_May 6th, 2024_ENVol. 006.pdf
TVB_The Vietnam Believer Newsletter_May 6th, 2024_ENVol. 006.pdf
 
Over the Top (OTT) Market Size & Growth Outlook 2024-2030
Over the Top (OTT) Market Size & Growth Outlook 2024-2030Over the Top (OTT) Market Size & Growth Outlook 2024-2030
Over the Top (OTT) Market Size & Growth Outlook 2024-2030
 
joint cost.pptx COST ACCOUNTING Sixteenth Edition ...
joint cost.pptx  COST ACCOUNTING  Sixteenth Edition                          ...joint cost.pptx  COST ACCOUNTING  Sixteenth Edition                          ...
joint cost.pptx COST ACCOUNTING Sixteenth Edition ...
 
Getting Real with AI - Columbus DAW - May 2024 - Nick Woo from AlignAI
Getting Real with AI - Columbus DAW - May 2024 - Nick Woo from AlignAIGetting Real with AI - Columbus DAW - May 2024 - Nick Woo from AlignAI
Getting Real with AI - Columbus DAW - May 2024 - Nick Woo from AlignAI
 
Phases of Negotiation .pptx
 Phases of Negotiation .pptx Phases of Negotiation .pptx
Phases of Negotiation .pptx
 
Unveiling Falcon Invoice Discounting: Leading the Way as India's Premier Bill...
Unveiling Falcon Invoice Discounting: Leading the Way as India's Premier Bill...Unveiling Falcon Invoice Discounting: Leading the Way as India's Premier Bill...
Unveiling Falcon Invoice Discounting: Leading the Way as India's Premier Bill...
 
Jual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan Cytotec
Jual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan CytotecJual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan Cytotec
Jual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan Cytotec
 
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in OmanMifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
 
Paradip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
Paradip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDINGParadip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
Paradip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
 
Pre Engineered Building Manufacturers Hyderabad.pptx
Pre Engineered  Building Manufacturers Hyderabad.pptxPre Engineered  Building Manufacturers Hyderabad.pptx
Pre Engineered Building Manufacturers Hyderabad.pptx
 
Falcon Invoice Discounting: Tailored Financial Wings
Falcon Invoice Discounting: Tailored Financial WingsFalcon Invoice Discounting: Tailored Financial Wings
Falcon Invoice Discounting: Tailored Financial Wings
 
!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...
!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...
!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...
 

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