Euruko 2012 - JRuby

Charles Nutter
Charles NutterProgrammer um Engine Yard
JRuby!
Me

• Charles Oliver Nutter
 • @headius
• Java developer since 1996
• JRuby developer since 2006
• Starting at Red Hat on Monday!
Red Hat FAQ

• Primary job still JRuby
• Expanding to help other languages
• Working with OpenJDK team
• Continuing to support EY JRuby efforts
What is JRuby?
Ruby on JVM
• Core classes and runtime in Java
 • Moving parts to Ruby over time
• Standard command line
• 1.8 and 1.9 compatible
 • 1.9 default in JRuby 1.7
• Drop in replacement for MRI*
*caveats
• Weak low-level UNIX stuff
 • Improving over time
• Poor C extension support
 • Not maintained...off by default in 1.7
• Some features differ or unavailable
 • ObjectSpace, trace funcs, callcc...
JRuby 1.7 (preview)

• Ruby 1.9.3 mode by default
 • Many 1.9 compat fixes
• Numerous perf improvements
 • Java 7 invokedynamic support
• Beginning of new optimizing compiler
Getting Started

• Need a JVM...
• rvm install jruby
 • rvm install jruby-1.7.0-preview1
• Download manually
 • Unpack, edit PATH, done
Try it Out
JRuby is the best*
  Ruby runtime
The Team
JRuby Team
JRuby Team


    Charlie
JRuby Team

               Charlie                  Tom




Nick   Hiro   Marcin     Nahi   Wayne   Subbu   Douglas   Douglas
                                                           Douglas
                                                           Contribs
JRuby Team

                Charlie                          Tom




Nick   Hiro    Marcin        Nahi     Wayne      Subbu    Douglas   Douglas
                                                                     Douglas
                                                                     Contribs




          Douglas
           Douglas        Douglas
                           Douglas    Douglas
                                       Douglas       Douglas
                                                       Other
                                                      Douglas
           OpenJDK          Android       J9
                                                         JVMs
JRuby Structure
                 JRuby
          Bytecode    Core       Java
Parser
             JIT     Classes    Integ

                 JVM
                       Native
Threads     GC                  C API
                        JIT
JRuby Structure
                   JRuby
             Bytecode    Core      Java
    Parser
                JIT     Classes   Integ


JRuby team can focus on implementing JRuby.
JRuby Team Doesn’t
     Have to Work On*
•   Memory allocation     •   Native JIT

•   Garbage collectors    •   Tooling

•   Native threading      •   Server environments

•   Cross-platform        •   Native extensions

•   Mobile/Embedded VMs
We could stop working
on JRuby and it would
continue to get faster.
Google Summer
        of Code
• JRuby accepted as an organization
• Eight students!
 • Shoes, Krypt, evented IO, fibers, Ruboto,
    IR dumping, IR to Dalvik, benchmarking
• Three more from C42
Platforms
Systems

• Best Ruby on Windows?
• Exotic platforms: zLinux, OpenVMS, AS/400
• Android’s Dalvik
• Embedded JVMs
Ruboto
Servers

• Any Java server can host Ruby
• Trinidad
 • Ruby-style CLI server atop Tomcat
• Torquebox
 • Full Ruby stack atop JBossAS
Torquebox
•   Rack-compatible         •   Server management

•   Database connectivity   •   Clustering

•   Background daemons      •   In and out-process cache

•   Scheduled jobs          •   Web sockets

•   Messaging               •   Authentication

•   Asynchronous tasks      •   XA Transactions
Torquebox
•   Rack-compatible         •   Server management

•   Database connectivity   •   Clustering

•   All R
    Background daemons      •   In and out-process cache

•   Scheduled jobs
                      uby   •   Web sockets

•   Messaging
                          APIs
                            •   Authentication

•   Asynchronous tasks      • ! XA Transactions
Libraries
Libraries

• 340k versioned jars in Maven central
 • Compare to 35k gems in RubyGems.org
• Vast majority have no native code
• All usable from JRuby
Euruko 2012 - JRuby
Euruko 2012 - JRuby
Midi Example
GC
JVM GC
• Wide array of options
 • Generation size, worker threads,
    concurrency, tenuring...
• Many GCs to choose from
• Scales up to massive heaps
• Best GCs in the world!
class Simple
  attr_accessor :next
end

top = Simple.new

puts Benchmark.measure {
  outer = 10
  total = 100000
  per = 100

  outer.times do
    total.times do
      per.times { Simple.new }
      s = Simple.new
      top.next = s
      top = s
    end
  end
}
15
                GC time %
11.25


  7.5


 3.75


   0
        JRuby               Ruby 1.9.3
Threads
Real Parallellism

• Ruby thread = JVM thread = native thread
• One process can use all cores
• One server can handle all requests
require 'benchmark'

ary = (1..1000000).to_a

loop {
  puts Benchmark.measure {
    10.times {
      ary.each {|i|}
    }
  }
}
require 'benchmark'

ary = (1..1000000).to_a

loop {
  puts Benchmark.measure {
    (1..10).map {
      Thread.new {
        ary.each {|i|}
      }
    }.map(&:join)
  }
}
Euruko 2012 - JRuby
Ruby 1.9
unthreaded
Ruby 1.9    Ruby 1.9
unthreaded   threaded
Ruby 1.9    Ruby 1.9
unthreaded   threaded




  JRuby
unthreaded
Ruby 1.9    Ruby 1.9
unthreaded   threaded




  JRuby        JRuby
unthreaded   threaded
threaded_reverse

 0.8



0.65



 0.5



0.35



 0.2
       one thread   two threads     three threads   four threads
Nonlinear?

• More work means more objects
• More objects needs memory bandwidth
• No different from multi-process
Performance
Performance

• JRuby compiles Ruby to JVM bytecode
• JVM compiles bytecode to native
• Best JIT technology in the world
• Getting even better with invokedynamic
def foo
  bar
end

def bar
  baz     foo   bar   baz
end

def baz
  # ...
end
JRuby on Java 5/6
def foo
  bar
end

def bar            JRuby            JRuby
  baz     foo        call   bar       call     baz
end                 logic            logic
def baz
  # ...
end
                Kills many JVM optimizations
JRuby on Java 7
def foo
  bar




                   X X
end

def bar             JRuby             JRuby
  baz     foo         call    bar       call   baz
end                  logic             logic
def baz
  # ...
end
                Dynamic call logic built into JVM
JRuby on Java 7
def foo
  bar
end

def bar
  baz     foo               bar              baz
end

def baz
  # ...
end
                Straight through dispatch path
JRuby on Java 7
def foo
  bar
end

def bar
  baz           foo       bar       baz
end

def baz
  # ...
end
          Optimizations (like inlining) can happen!
Euruko 2012 - JRuby
JRuby/Java 6   JRuby/Java 7
JRuby/Java 6                   JRuby/Java 7
                        Times Faster than Ruby 1.9.3
  5



3.75



 2.5



1.25



  0
       base64      richards        neural      mandelbrot     redblack
JRuby/Java 6                     JRuby/Java 7
                            Times Faster than Ruby 1.9.3
  5



3.75



 2.5

                                    1.914          1.806
                    1.538                                         1.565
1.25   1.346




  0
         base64      richards          neural      mandelbrot      redblack
JRuby/Java 6                     JRuby/Java 7
                                 Times Faster than Ruby 1.9.3
  5


                                                                4.226           4.32
3.75
                                                 3.66
                                 3.44


 2.5           2.658


                                         1.914          1.806
                         1.538                                          1.565
1.25   1.346




  0
         base64           richards          neural      mandelbrot       redblack
Euruko 2012 - JRuby
Tools
Profiling

• Java profilers
 • VisualVM,YourKit, NetBeans, JXInsight
• jruby [--profile | --profile.graph]
• jruby -Xreify.classes=true
• JVM command-line profilers
Monitoring

• Java Management Extensions (JMX)
 • Gems available for clients and servers
• jconsole and VisualVM
• Most servers provide additional tools
• New Relic, etc have JVM support
VisualVM

• CPU, memory, thread monitoring
• CPU and memory profiling
• VisualGC
• Heap analysis
Euruko 2012 - JRuby
Euruko 2012 - JRuby
Your Turn

• Try your apps on JRuby and tell us
• Turn on JRuby in @travisci
• Let us know what you think of JRuby
• Help us make JRuby even better!
Thank you!

• @headius
• jruby.org
• torquebox.org
1 von 67

Recomendados

Aloha RubyConf 2012 - JRuby von
Aloha RubyConf 2012 - JRubyAloha RubyConf 2012 - JRuby
Aloha RubyConf 2012 - JRubyCharles Nutter
2.4K views110 Folien
Why JRuby? von
Why JRuby?Why JRuby?
Why JRuby?Fiona Tay
22.8K views57 Folien
JRuby in the enterprise von
JRuby in the enterpriseJRuby in the enterprise
JRuby in the enterpriseJerry Gulla
2.7K views83 Folien
Migrate to JRuby von
Migrate to JRubyMigrate to JRuby
Migrate to JRubyIan Yang
734 views52 Folien
Практики применения JRuby von
Практики применения JRubyПрактики применения JRuby
Практики применения JRuby.toster
967 views128 Folien
5장. Execution Engine von
5장. Execution Engine5장. Execution Engine
5장. Execution Engine김 한도
4.8K views61 Folien

Más contenido relacionado

Was ist angesagt?

6장 Thread Synchronization von
6장 Thread Synchronization6장 Thread Synchronization
6장 Thread Synchronization김 한도
5.6K views33 Folien
4장. Class Loader von
4장. Class Loader4장. Class Loader
4장. Class Loader김 한도
6.5K views43 Folien
3장. Garbage Collection von
3장. Garbage Collection3장. Garbage Collection
3장. Garbage Collection김 한도
7.4K views330 Folien
Improve extension API: C++ as better language for extension von
Improve extension API: C++ as better language for extensionImprove extension API: C++ as better language for extension
Improve extension API: C++ as better language for extensionKouhei Sutou
2.1K views102 Folien
1장 Java란 무엇인가.key von
1장 Java란 무엇인가.key1장 Java란 무엇인가.key
1장 Java란 무엇인가.key김 한도
8K views24 Folien
An introduction and future of Ruby coverage library von
An introduction and future of Ruby coverage libraryAn introduction and future of Ruby coverage library
An introduction and future of Ruby coverage librarymametter
6.6K views58 Folien

Was ist angesagt?(20)

6장 Thread Synchronization von 김 한도
6장 Thread Synchronization6장 Thread Synchronization
6장 Thread Synchronization
김 한도5.6K views
4장. Class Loader von 김 한도
4장. Class Loader4장. Class Loader
4장. Class Loader
김 한도6.5K views
3장. Garbage Collection von 김 한도
3장. Garbage Collection3장. Garbage Collection
3장. Garbage Collection
김 한도7.4K views
Improve extension API: C++ as better language for extension von Kouhei Sutou
Improve extension API: C++ as better language for extensionImprove extension API: C++ as better language for extension
Improve extension API: C++ as better language for extension
Kouhei Sutou2.1K views
1장 Java란 무엇인가.key von 김 한도
1장 Java란 무엇인가.key1장 Java란 무엇인가.key
1장 Java란 무엇인가.key
김 한도8K views
An introduction and future of Ruby coverage library von mametter
An introduction and future of Ruby coverage libraryAn introduction and future of Ruby coverage library
An introduction and future of Ruby coverage library
mametter6.6K views
Polyglot Plugin Programming von Atlassian
Polyglot Plugin ProgrammingPolyglot Plugin Programming
Polyglot Plugin Programming
Atlassian1.1K views
7장 Oracle As Datasource von 김 한도
7장 Oracle As Datasource7장 Oracle As Datasource
7장 Oracle As Datasource
김 한도5K views
Diagnosing Your Application on the JVM von Staffan Larsen
Diagnosing Your Application on the JVMDiagnosing Your Application on the JVM
Diagnosing Your Application on the JVM
Staffan Larsen2.5K views
TorqueBox at DC:JBUG - November 2011 von bobmcwhirter
TorqueBox at DC:JBUG - November 2011TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011
bobmcwhirter767 views
DataMapper on Infinispan von Lance Ball
DataMapper on InfinispanDataMapper on Infinispan
DataMapper on Infinispan
Lance Ball2.4K views
The JVM is your friend von Kai Koenig
The JVM is your friendThe JVM is your friend
The JVM is your friend
Kai Koenig2K views
Testing Ember Apps von jo_liss
Testing Ember AppsTesting Ember Apps
Testing Ember Apps
jo_liss10K views
JRoR Deploying Rails on JRuby von elliando dias
JRoR Deploying Rails on JRubyJRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRuby
elliando dias810 views
Rocket Fuelled Cucumbers von Joseph Wilk
Rocket Fuelled CucumbersRocket Fuelled Cucumbers
Rocket Fuelled Cucumbers
Joseph Wilk6.1K views
Java tuning on GNU/Linux for busy dev von Tomek Borek
Java tuning on GNU/Linux for busy devJava tuning on GNU/Linux for busy dev
Java tuning on GNU/Linux for busy dev
Tomek Borek780 views
TorqueBox - Ruby Hoedown 2011 von Lance Ball
TorqueBox - Ruby Hoedown 2011TorqueBox - Ruby Hoedown 2011
TorqueBox - Ruby Hoedown 2011
Lance Ball696 views

Similar a Euruko 2012 - JRuby

Introduction to JRuby von
Introduction to JRubyIntroduction to JRuby
Introduction to JRubyajuckel
1.2K views37 Folien
The Year of JRuby - RubyC 2018 von
The Year of JRuby - RubyC 2018The Year of JRuby - RubyC 2018
The Year of JRuby - RubyC 2018Charles Nutter
860 views61 Folien
Why JRuby? - RubyConf 2012 von
Why JRuby? - RubyConf 2012Why JRuby? - RubyConf 2012
Why JRuby? - RubyConf 2012Charles Nutter
1.8K views126 Folien
JRuby: What's Different (RORO Melbourne October 2011) von
JRuby: What's Different (RORO Melbourne October 2011)JRuby: What's Different (RORO Melbourne October 2011)
JRuby: What's Different (RORO Melbourne October 2011)Charles Nutter
610 views85 Folien
JRuby - The Best of Java and Ruby von
JRuby - The Best of Java and RubyJRuby - The Best of Java and Ruby
JRuby - The Best of Java and RubyEvgeny Rahman
1K views13 Folien
Ruby Performance - The Last Mile - RubyConf India 2016 von
Ruby Performance - The Last Mile - RubyConf India 2016Ruby Performance - The Last Mile - RubyConf India 2016
Ruby Performance - The Last Mile - RubyConf India 2016Charles Nutter
2.4K views106 Folien

Similar a Euruko 2012 - JRuby(20)

Introduction to JRuby von ajuckel
Introduction to JRubyIntroduction to JRuby
Introduction to JRuby
ajuckel1.2K views
The Year of JRuby - RubyC 2018 von Charles Nutter
The Year of JRuby - RubyC 2018The Year of JRuby - RubyC 2018
The Year of JRuby - RubyC 2018
Charles Nutter860 views
JRuby: What's Different (RORO Melbourne October 2011) von Charles Nutter
JRuby: What's Different (RORO Melbourne October 2011)JRuby: What's Different (RORO Melbourne October 2011)
JRuby: What's Different (RORO Melbourne October 2011)
Charles Nutter610 views
JRuby - The Best of Java and Ruby von Evgeny Rahman
JRuby - The Best of Java and RubyJRuby - The Best of Java and Ruby
JRuby - The Best of Java and Ruby
Evgeny Rahman1K views
Ruby Performance - The Last Mile - RubyConf India 2016 von Charles Nutter
Ruby Performance - The Last Mile - RubyConf India 2016Ruby Performance - The Last Mile - RubyConf India 2016
Ruby Performance - The Last Mile - RubyConf India 2016
Charles Nutter2.4K views
Glass fish rubyconf-india-2010-Arun gupta von ThoughtWorks
Glass fish rubyconf-india-2010-Arun gupta Glass fish rubyconf-india-2010-Arun gupta
Glass fish rubyconf-india-2010-Arun gupta
ThoughtWorks943 views
GlassFish can support multiple Ruby frameworks ... really ? von Arun Gupta
GlassFish can support multiple Ruby frameworks ... really ?GlassFish can support multiple Ruby frameworks ... really ?
GlassFish can support multiple Ruby frameworks ... really ?
Arun Gupta8K views
T4T Training day - NodeJS von Tim Sommer
T4T Training day - NodeJST4T Training day - NodeJS
T4T Training day - NodeJS
Tim Sommer764 views
JRuby on Rails - RoR's Simplicity Meets Java's Class (a case in point) von Darshan Karandikar
JRuby on Rails - RoR's Simplicity Meets Java's Class (a case in point)JRuby on Rails - RoR's Simplicity Meets Java's Class (a case in point)
JRuby on Rails - RoR's Simplicity Meets Java's Class (a case in point)
Darshan Karandikar1.2K views
Jruby synergy-of-ruby-and-java von Keith Bennett
Jruby synergy-of-ruby-and-javaJruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-java
Keith Bennett1.1K views
JRuby - The Perfect Alternative von Ram Vijapurapu
JRuby - The Perfect AlternativeJRuby - The Perfect Alternative
JRuby - The Perfect Alternative
Ram Vijapurapu681 views
JRuby 9000 - Taipei Ruby User's Group 2015 von Charles Nutter
JRuby 9000 - Taipei Ruby User's Group 2015JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015
Charles Nutter1.2K views
Java Edge.2009.Grails.Web.Dev.Made.Easy von roialdaag
Java Edge.2009.Grails.Web.Dev.Made.EasyJava Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.Easy
roialdaag1.5K views
Beyond JVM - YOW Melbourne 2013 von Charles Nutter
Beyond JVM - YOW Melbourne 2013Beyond JVM - YOW Melbourne 2013
Beyond JVM - YOW Melbourne 2013
Charles Nutter3.3K views
The Enterprise Strikes Back von Burke Libbey
The Enterprise Strikes BackThe Enterprise Strikes Back
The Enterprise Strikes Back
Burke Libbey1.2K views

Más de Charles Nutter

Down the Rabbit Hole: An Adventure in JVM Wonderland von
Down the Rabbit Hole: An Adventure in JVM WonderlandDown the Rabbit Hole: An Adventure in JVM Wonderland
Down the Rabbit Hole: An Adventure in JVM WonderlandCharles Nutter
2.6K views128 Folien
JRuby 9000 - Optimizing Above the JVM von
JRuby 9000 - Optimizing Above the JVMJRuby 9000 - Optimizing Above the JVM
JRuby 9000 - Optimizing Above the JVMCharles Nutter
2.1K views65 Folien
JRuby and Invokedynamic - Japan JUG 2015 von
JRuby and Invokedynamic - Japan JUG 2015JRuby and Invokedynamic - Japan JUG 2015
JRuby and Invokedynamic - Japan JUG 2015Charles Nutter
1.6K views89 Folien
Fast as C: How to Write Really Terrible Java von
Fast as C: How to Write Really Terrible JavaFast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible JavaCharles Nutter
10.6K views132 Folien
Open Source Software Needs You! von
Open Source Software Needs You!Open Source Software Needs You!
Open Source Software Needs You!Charles Nutter
2.4K views86 Folien
InvokeBinder: Fluent Programming for Method Handles von
InvokeBinder: Fluent Programming for Method HandlesInvokeBinder: Fluent Programming for Method Handles
InvokeBinder: Fluent Programming for Method HandlesCharles Nutter
2.3K views64 Folien

Más de Charles Nutter(20)

Down the Rabbit Hole: An Adventure in JVM Wonderland von Charles Nutter
Down the Rabbit Hole: An Adventure in JVM WonderlandDown the Rabbit Hole: An Adventure in JVM Wonderland
Down the Rabbit Hole: An Adventure in JVM Wonderland
Charles Nutter2.6K views
JRuby 9000 - Optimizing Above the JVM von Charles Nutter
JRuby 9000 - Optimizing Above the JVMJRuby 9000 - Optimizing Above the JVM
JRuby 9000 - Optimizing Above the JVM
Charles Nutter2.1K views
JRuby and Invokedynamic - Japan JUG 2015 von Charles Nutter
JRuby and Invokedynamic - Japan JUG 2015JRuby and Invokedynamic - Japan JUG 2015
JRuby and Invokedynamic - Japan JUG 2015
Charles Nutter1.6K views
Fast as C: How to Write Really Terrible Java von Charles Nutter
Fast as C: How to Write Really Terrible JavaFast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible Java
Charles Nutter10.6K views
Open Source Software Needs You! von Charles Nutter
Open Source Software Needs You!Open Source Software Needs You!
Open Source Software Needs You!
Charles Nutter2.4K views
InvokeBinder: Fluent Programming for Method Handles von Charles Nutter
InvokeBinder: Fluent Programming for Method HandlesInvokeBinder: Fluent Programming for Method Handles
InvokeBinder: Fluent Programming for Method Handles
Charles Nutter2.3K views
Doing Open Source the Right Way von Charles Nutter
Doing Open Source the Right WayDoing Open Source the Right Way
Doing Open Source the Right Way
Charles Nutter2.3K views
Bringing Concurrency to Ruby - RubyConf India 2014 von Charles Nutter
Bringing Concurrency to Ruby - RubyConf India 2014Bringing Concurrency to Ruby - RubyConf India 2014
Bringing Concurrency to Ruby - RubyConf India 2014
Charles Nutter4.9K views
Beyond JVM - YOW! Sydney 2013 von Charles Nutter
Beyond JVM - YOW! Sydney 2013Beyond JVM - YOW! Sydney 2013
Beyond JVM - YOW! Sydney 2013
Charles Nutter3.2K views
Beyond JVM - YOW! Brisbane 2013 von Charles Nutter
Beyond JVM - YOW! Brisbane 2013Beyond JVM - YOW! Brisbane 2013
Beyond JVM - YOW! Brisbane 2013
Charles Nutter1.8K views
The Future of JRuby - Baruco 2013 von Charles Nutter
The Future of JRuby - Baruco 2013The Future of JRuby - Baruco 2013
The Future of JRuby - Baruco 2013
Charles Nutter3.2K views
High Performance Ruby - E4E Conference 2013 von Charles Nutter
High Performance Ruby - E4E Conference 2013High Performance Ruby - E4E Conference 2013
High Performance Ruby - E4E Conference 2013
Charles Nutter5K views
Invokedynamic: Tales from the Trenches von Charles Nutter
Invokedynamic: Tales from the TrenchesInvokedynamic: Tales from the Trenches
Invokedynamic: Tales from the Trenches
Charles Nutter2.2K views
JavaOne 2012 - JVM JIT for Dummies von Charles Nutter
JavaOne 2012 - JVM JIT for DummiesJavaOne 2012 - JVM JIT for Dummies
JavaOne 2012 - JVM JIT for Dummies
Charles Nutter11K views
High Performance Ruby - Golden Gate RubyConf 2012 von Charles Nutter
High Performance Ruby - Golden Gate RubyConf 2012High Performance Ruby - Golden Gate RubyConf 2012
High Performance Ruby - Golden Gate RubyConf 2012
Charles Nutter9K views
InvokeDynamic - You Ain't Seen Nothin Yet von Charles Nutter
InvokeDynamic - You Ain't Seen Nothin YetInvokeDynamic - You Ain't Seen Nothin Yet
InvokeDynamic - You Ain't Seen Nothin Yet
Charles Nutter3.6K views
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ... von Charles Nutter
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Charles Nutter8.5K views

Último

Voice Logger - Telephony Integration Solution at Aegis von
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at AegisNirmal Sharma
17 views1 Folie
Transcript: The Details of Description Techniques tips and tangents on altern... von
Transcript: The Details of Description Techniques tips and tangents on altern...Transcript: The Details of Description Techniques tips and tangents on altern...
Transcript: The Details of Description Techniques tips and tangents on altern...BookNet Canada
130 views15 Folien
1st parposal presentation.pptx von
1st parposal presentation.pptx1st parposal presentation.pptx
1st parposal presentation.pptxi238212
9 views3 Folien
DALI Basics Course 2023 von
DALI Basics Course  2023DALI Basics Course  2023
DALI Basics Course 2023Ivory Egg
14 views12 Folien
Perth MeetUp November 2023 von
Perth MeetUp November 2023 Perth MeetUp November 2023
Perth MeetUp November 2023 Michael Price
15 views44 Folien
Piloting & Scaling Successfully With Microsoft Viva von
Piloting & Scaling Successfully With Microsoft VivaPiloting & Scaling Successfully With Microsoft Viva
Piloting & Scaling Successfully With Microsoft VivaRichard Harbridge
10 views160 Folien

Último(20)

Voice Logger - Telephony Integration Solution at Aegis von Nirmal Sharma
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at Aegis
Nirmal Sharma17 views
Transcript: The Details of Description Techniques tips and tangents on altern... von BookNet Canada
Transcript: The Details of Description Techniques tips and tangents on altern...Transcript: The Details of Description Techniques tips and tangents on altern...
Transcript: The Details of Description Techniques tips and tangents on altern...
BookNet Canada130 views
1st parposal presentation.pptx von i238212
1st parposal presentation.pptx1st parposal presentation.pptx
1st parposal presentation.pptx
i2382129 views
DALI Basics Course 2023 von Ivory Egg
DALI Basics Course  2023DALI Basics Course  2023
DALI Basics Course 2023
Ivory Egg14 views
Perth MeetUp November 2023 von Michael Price
Perth MeetUp November 2023 Perth MeetUp November 2023
Perth MeetUp November 2023
Michael Price15 views
Piloting & Scaling Successfully With Microsoft Viva von Richard Harbridge
Piloting & Scaling Successfully With Microsoft VivaPiloting & Scaling Successfully With Microsoft Viva
Piloting & Scaling Successfully With Microsoft Viva
PharoJS - Zürich Smalltalk Group Meetup November 2023 von Noury Bouraqadi
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023
Noury Bouraqadi120 views
Web Dev - 1 PPT.pdf von gdsczhcet
Web Dev - 1 PPT.pdfWeb Dev - 1 PPT.pdf
Web Dev - 1 PPT.pdf
gdsczhcet55 views
Attacking IoT Devices from a Web Perspective - Linux Day von Simone Onofri
Attacking IoT Devices from a Web Perspective - Linux Day Attacking IoT Devices from a Web Perspective - Linux Day
Attacking IoT Devices from a Web Perspective - Linux Day
Simone Onofri15 views
Unit 1_Lecture 2_Physical Design of IoT.pdf von StephenTec
Unit 1_Lecture 2_Physical Design of IoT.pdfUnit 1_Lecture 2_Physical Design of IoT.pdf
Unit 1_Lecture 2_Physical Design of IoT.pdf
StephenTec11 views
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... von James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson33 views
Business Analyst Series 2023 - Week 3 Session 5 von DianaGray10
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5
DianaGray10209 views
Spesifikasi Lengkap ASUS Vivobook Go 14 von Dot Semarang
Spesifikasi Lengkap ASUS Vivobook Go 14Spesifikasi Lengkap ASUS Vivobook Go 14
Spesifikasi Lengkap ASUS Vivobook Go 14
Dot Semarang35 views
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... von Bernd Ruecker
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
Bernd Ruecker26 views
STPI OctaNE CoE Brochure.pdf von madhurjyapb
STPI OctaNE CoE Brochure.pdfSTPI OctaNE CoE Brochure.pdf
STPI OctaNE CoE Brochure.pdf
madhurjyapb12 views
Special_edition_innovator_2023.pdf von WillDavies22
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdf
WillDavies2216 views

Euruko 2012 - JRuby

  • 2. Me • Charles Oliver Nutter • @headius • Java developer since 1996 • JRuby developer since 2006 • Starting at Red Hat on Monday!
  • 3. Red Hat FAQ • Primary job still JRuby • Expanding to help other languages • Working with OpenJDK team • Continuing to support EY JRuby efforts
  • 5. Ruby on JVM • Core classes and runtime in Java • Moving parts to Ruby over time • Standard command line • 1.8 and 1.9 compatible • 1.9 default in JRuby 1.7 • Drop in replacement for MRI*
  • 6. *caveats • Weak low-level UNIX stuff • Improving over time • Poor C extension support • Not maintained...off by default in 1.7 • Some features differ or unavailable • ObjectSpace, trace funcs, callcc...
  • 7. JRuby 1.7 (preview) • Ruby 1.9.3 mode by default • Many 1.9 compat fixes • Numerous perf improvements • Java 7 invokedynamic support • Beginning of new optimizing compiler
  • 8. Getting Started • Need a JVM... • rvm install jruby • rvm install jruby-1.7.0-preview1 • Download manually • Unpack, edit PATH, done
  • 10. JRuby is the best* Ruby runtime
  • 13. JRuby Team Charlie
  • 14. JRuby Team Charlie Tom Nick Hiro Marcin Nahi Wayne Subbu Douglas Douglas Douglas Contribs
  • 15. JRuby Team Charlie Tom Nick Hiro Marcin Nahi Wayne Subbu Douglas Douglas Douglas Contribs Douglas Douglas Douglas Douglas Douglas Douglas Douglas Other Douglas OpenJDK Android J9 JVMs
  • 16. JRuby Structure JRuby Bytecode Core Java Parser JIT Classes Integ JVM Native Threads GC C API JIT
  • 17. JRuby Structure JRuby Bytecode Core Java Parser JIT Classes Integ JRuby team can focus on implementing JRuby.
  • 18. JRuby Team Doesn’t Have to Work On* • Memory allocation • Native JIT • Garbage collectors • Tooling • Native threading • Server environments • Cross-platform • Native extensions • Mobile/Embedded VMs
  • 19. We could stop working on JRuby and it would continue to get faster.
  • 20. Google Summer of Code • JRuby accepted as an organization • Eight students! • Shoes, Krypt, evented IO, fibers, Ruboto, IR dumping, IR to Dalvik, benchmarking • Three more from C42
  • 22. Systems • Best Ruby on Windows? • Exotic platforms: zLinux, OpenVMS, AS/400 • Android’s Dalvik • Embedded JVMs
  • 24. Servers • Any Java server can host Ruby • Trinidad • Ruby-style CLI server atop Tomcat • Torquebox • Full Ruby stack atop JBossAS
  • 25. Torquebox • Rack-compatible • Server management • Database connectivity • Clustering • Background daemons • In and out-process cache • Scheduled jobs • Web sockets • Messaging • Authentication • Asynchronous tasks • XA Transactions
  • 26. Torquebox • Rack-compatible • Server management • Database connectivity • Clustering • All R Background daemons • In and out-process cache • Scheduled jobs uby • Web sockets • Messaging APIs • Authentication • Asynchronous tasks • ! XA Transactions
  • 28. Libraries • 340k versioned jars in Maven central • Compare to 35k gems in RubyGems.org • Vast majority have no native code • All usable from JRuby
  • 32. GC
  • 33. JVM GC • Wide array of options • Generation size, worker threads, concurrency, tenuring... • Many GCs to choose from • Scales up to massive heaps • Best GCs in the world!
  • 34. class Simple   attr_accessor :next end top = Simple.new puts Benchmark.measure {   outer = 10   total = 100000   per = 100   outer.times do     total.times do       per.times { Simple.new }       s = Simple.new       top.next = s       top = s     end   end }
  • 35. 15 GC time % 11.25 7.5 3.75 0 JRuby Ruby 1.9.3
  • 37. Real Parallellism • Ruby thread = JVM thread = native thread • One process can use all cores • One server can handle all requests
  • 38. require 'benchmark' ary = (1..1000000).to_a loop {   puts Benchmark.measure {     10.times {       ary.each {|i|}     }   } }
  • 39. require 'benchmark' ary = (1..1000000).to_a loop {   puts Benchmark.measure {     (1..10).map {       Thread.new {         ary.each {|i|}       }     }.map(&:join)   } }
  • 42. Ruby 1.9 Ruby 1.9 unthreaded threaded
  • 43. Ruby 1.9 Ruby 1.9 unthreaded threaded JRuby unthreaded
  • 44. Ruby 1.9 Ruby 1.9 unthreaded threaded JRuby JRuby unthreaded threaded
  • 45. threaded_reverse 0.8 0.65 0.5 0.35 0.2 one thread two threads three threads four threads
  • 46. Nonlinear? • More work means more objects • More objects needs memory bandwidth • No different from multi-process
  • 48. Performance • JRuby compiles Ruby to JVM bytecode • JVM compiles bytecode to native • Best JIT technology in the world • Getting even better with invokedynamic
  • 49. def foo bar end def bar baz foo bar baz end def baz # ... end
  • 50. JRuby on Java 5/6 def foo bar end def bar JRuby JRuby baz foo call bar call baz end logic logic def baz # ... end Kills many JVM optimizations
  • 51. JRuby on Java 7 def foo bar X X end def bar JRuby JRuby baz foo call bar call baz end logic logic def baz # ... end Dynamic call logic built into JVM
  • 52. JRuby on Java 7 def foo bar end def bar baz foo bar baz end def baz # ... end Straight through dispatch path
  • 53. JRuby on Java 7 def foo bar end def bar baz foo bar baz end def baz # ... end Optimizations (like inlining) can happen!
  • 55. JRuby/Java 6 JRuby/Java 7
  • 56. JRuby/Java 6 JRuby/Java 7 Times Faster than Ruby 1.9.3 5 3.75 2.5 1.25 0 base64 richards neural mandelbrot redblack
  • 57. JRuby/Java 6 JRuby/Java 7 Times Faster than Ruby 1.9.3 5 3.75 2.5 1.914 1.806 1.538 1.565 1.25 1.346 0 base64 richards neural mandelbrot redblack
  • 58. JRuby/Java 6 JRuby/Java 7 Times Faster than Ruby 1.9.3 5 4.226 4.32 3.75 3.66 3.44 2.5 2.658 1.914 1.806 1.538 1.565 1.25 1.346 0 base64 richards neural mandelbrot redblack
  • 60. Tools
  • 61. Profiling • Java profilers • VisualVM,YourKit, NetBeans, JXInsight • jruby [--profile | --profile.graph] • jruby -Xreify.classes=true • JVM command-line profilers
  • 62. Monitoring • Java Management Extensions (JMX) • Gems available for clients and servers • jconsole and VisualVM • Most servers provide additional tools • New Relic, etc have JVM support
  • 63. VisualVM • CPU, memory, thread monitoring • CPU and memory profiling • VisualGC • Heap analysis
  • 66. Your Turn • Try your apps on JRuby and tell us • Turn on JRuby in @travisci • Let us know what you think of JRuby • Help us make JRuby even better!
  • 67. Thank you! • @headius • jruby.org • torquebox.org

Hinweis der Redaktion

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n
  87. \n