Save 37% off PRO during our Black Friday Sale! »

The Story of JRuby

F1d37642fdaa1662ff46e4c65731e9ab?s=47 headius
September 30, 2017

The Story of JRuby

A brief history of JRuby

F1d37642fdaa1662ff46e4c65731e9ab?s=128

headius

September 30, 2017
Tweet

Transcript

  1. The Story of JRuby Charles Oliver Nutter @headius

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

    time to Budapest! • My last Euruko was in Amsterdam! • JRuby co-lead employed by Red Hat
  3. None
  4. Once upon a time...

  5. 24 February, 1993

  6. None
  7. None
  8. Andy Hunt Dave Thomas

  9. Jan Arne Petersen

  10. None
  11. None
  12. The Beginning • Basic parser based on MRI's parse.y •

    Pieces of core classes • Beginning of an interpreter • License, readme, etc
  13. None
  14. None
  15. None
  16. None
  17. 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
  18. And then...two quiet years

  19. None
  20. None
  21. YARV Rake Rubygems

  22. None
  23. None
  24. None
  25. None
  26. 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
  27. None
  28. 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
  29. Native Extensions • Almost all popular native libraries have JRuby

    support • Full support for calling C libraries through FFI • Rich, fast integration with Java libraries
  30. 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
  31. 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
  32. Overall: 99.57% ActiveSupport: 99.42% ActiveRecord: 99.66%

  33. 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
  34. Deploying with JRuby 9k Joe Kutner (@codefinger)

  35. JRuby is a JVM Language • Fast, precise, concurrent garbage

    collection • Optimizing native JIT • Parallel threading • All the libraries the JVM has to offer
  36. 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
  37. 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
  38. JVM Tools

  39. None
  40. 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
  41. 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
  42. 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
  43. Parallel and Concurrent

  44. 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
  45. None
  46. 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
  47. Brakeman Pro https://brakemanpro.com

  48. Scripting Minecraft event(:player_egg_throw) do |e| e.hatching = true e.num_hatches =

    120 e.player.mesg "hatched" end Purugin
  49. ...and so much more!

  50. What Next?

  51. None
  52. None
  53. Installing • Use your favorite Ruby installer • Linux packages

    • Windows installation from JRuby.org • Unpack, add to PATH
  54. 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!
  55. 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
  56. 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
  57. Get Involved • irc.freenode.net #jruby • jruby@ruby-lang.org • https://github.com/jruby/jruby •

    "You guys are the easiest open source team to work with in my career" - anonymous contributor
  58. Thank You! Charles Oliver Nutter headius@headius.com @headius http://jruby.org https://github.com/jruby/jruby