Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Story of JRuby

September 30, 2017

The Story of JRuby

A brief history of JRuby


September 30, 2017

More Decks by headius

Other Decks in Programming


  1. Hello Euruko! • Charles Oliver Nutter (@headius) • My first

    time to Budapest! • My last Euruko was in Amsterdam! • JRuby co-lead employed by Red Hat
  2. The Beginning • Basic parser based on MRI's parse.y •

    Pieces of core classes • Beginning of an interpreter • License, readme, etc
  3. Two Busy Years • 0.2.0 through 0.3.0 during 2001 •

    1.6_0.3.1 through 1.6_0.5.3 in 2002 • Basic Ruby 1.6 code starting to run • Early Java integration
  4. Eleven Exciting Years! • Hundreds of contributors • Thousands of

    issues reported and fixed • Tens of thousands of commits • Thank you to Red Hat, Engine Yard, and Sun Microsystems
  5. JRuby is Ruby • JRuby 9.1.x compatible with Ruby 2.3

    • 98% of language specs • 94% of core class specs • JRuby 9.2 (master) compatible with Ruby 2.4 • Features mostly complete • Working on next-gen optimizations
  6. Native Extensions • Almost all popular native libraries have JRuby

    support • Full support for calling C libraries through FFI • Rich, fast integration with Java libraries
  7. Rails • Rails 5 works today, mostly • ActiveRecord is

    very spotty • Lots of changes over the years • Lag in updating our adapters • Actively being improved right now • Goal is 100% passing Rails tests
  8. New Adapters • New sqlite3 adapter: 75% shared code from

    Rails • We expect similar ratio for mysql, pgsql • No version checks; support for one Rails version at a time • w.x.y.z: w.x will match Rails, y.z will be our versioning+security • Working with Rails to increase amount of shared code • Ideally, our extra code could just go in rails/rails
  9. Deploying JRuby • Ruby-style • We recommend puma or torquebox

    for the server; see also ratpack • Most deployers work (capistrano, etc) • Warbler, torquebox, and other tools for all-in-one executable jar • Java-style • Torquebox for full-stack env (messaging, scheduling, clustering and more in the box) • Warbler for existing Java servers • Full set of Maven utilities for heterogeneous apps
  10. JRuby is a JVM Language • Fast, precise, concurrent garbage

    collection • Optimizing native JIT • Parallel threading • All the libraries the JVM has to offer
  11. JVM Tooling • Wide range of GCs: parallel, concurrent, realtime,

    pauseless • Built-in tools for analyzing GC, JIT, thread, IO, heap • Built-in remote monitoring via JMX • Dozens of tools out there for profiling, management, and more
  12. VisualVM • Graphical console into your application • Monitor GC,

    threads, CPU usage • Sampled or full profiling with GUI browser • Live memory dumping, heap inspection • Ships with every OpenJDK install
  13. Optimizing Ruby • Run code through our profiling interpreter •

    JIT compile to JVM bytecode • Use invokedynamic to make dynamic calls fast • Optimize Ruby before sending it to bytecode • Start utilizing new Graal JVM JIT
  14. High Performance 0 2.5 5 7.5 10 blocks + loops

    benchmark, times faster than MRI 2.4.0 9.18x 8.29x 5.48x 1.34x 1.25x JRuby+JIT JRuby+JIT+indy JRuby+JIT+inline JRuby+JIT+inline+indy JRuby+JIT+inline+indy+Graal 0 7.5 15 22.5 30 mandelbrot generator, times faster than MRI 2.4.0 23.33x 2.91x JRuby+JIT+indy JRuby+JIT+indy+Graal
  15. Concurrency? Parallelism? • Parallelism happens on the hardware, e.g. multi-core

    • Concurrency happens in software, e.g. Thread API • You can have concurrency without parallelism • You can have both with JRuby
  16. Scripting Java • Interact with Java classes/objects as if they

    were Ruby classes/ objects • no compilation + no type declarations • short-cuts to reduce the syntactic gap
  17. JRuby + JavaFX class GaugeController include JRubyFX::Controller fxml "gauge.fxml" def

    initialize(*foo) @slider.value_property.add_listener do |slider| @gauge.gauge.value = slider.value end end end
  18. Installing • Use your favorite Ruby installer • Linux packages

    • Windows installation from JRuby.org • Unpack, add to PATH
  19. Herding Cats • Triage open issues • Add to or

    update wiki, docs • Respond to questions • Mailing lists (jruby, ruby-talk, ruby-dev, ...) • Social media (Twitter, IRC, Gitter, ...) • Get out there and talk to people!
  20. Use Ruby! • JRuby is also implemented in Ruby! •

    Growing "kernel" of Ruby code • 'date' ext is just Ruby calling a Java date/time lib • Reduce the Ruby to a “bite size” test or spec • Implement fix or new feature in Ruby • Working code first, perf concerns later
  21. Use Java! • Java knowledge is easy to pick up

    from Ruby • This ain't your daddy's Java • Can help with internals • Core methods • Compiler technology
  22. Get Involved • irc.freenode.net #jruby • [email protected] • https://github.com/jruby/jruby •

    "You guys are the easiest open source team to work with in my career" - anonymous contributor