Slide 1

Slide 1 text

The Story of JRuby Charles Oliver Nutter @headius

Slide 2

Slide 2 text

Hello Euruko! • Charles Oliver Nutter (@headius) • My first time to Budapest! • My last Euruko was in Amsterdam! • JRuby co-lead employed by Red Hat

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Once upon a time...

Slide 5

Slide 5 text

24 February, 1993

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

Andy Hunt Dave Thomas

Slide 9

Slide 9 text

Jan Arne Petersen

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

The Beginning • Basic parser based on MRI's parse.y • Pieces of core classes • Beginning of an interpreter • License, readme, etc

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

And then...two quiet years

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

YARV Rake Rubygems

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

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

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

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

Slide 29

Slide 29 text

Native Extensions • Almost all popular native libraries have JRuby support • Full support for calling C libraries through FFI • Rich, fast integration with Java libraries

Slide 30

Slide 30 text

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

Slide 31

Slide 31 text

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

Slide 32

Slide 32 text

Overall: 99.57% ActiveSupport: 99.42% ActiveRecord: 99.66%

Slide 33

Slide 33 text

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

Slide 34

Slide 34 text

Deploying with JRuby 9k Joe Kutner (@codefinger)

Slide 35

Slide 35 text

JRuby is a JVM Language • Fast, precise, concurrent garbage collection • Optimizing native JIT • Parallel threading • All the libraries the JVM has to offer

Slide 36

Slide 36 text

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

Slide 37

Slide 37 text

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

Slide 38

Slide 38 text

JVM Tools

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

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

Slide 41

Slide 41 text

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

Slide 42

Slide 42 text

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

Slide 43

Slide 43 text

Parallel and Concurrent

Slide 44

Slide 44 text

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

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

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

Slide 47

Slide 47 text

Brakeman Pro https://brakemanpro.com

Slide 48

Slide 48 text

Scripting Minecraft event(:player_egg_throw) do |e| e.hatching = true e.num_hatches = 120 e.player.mesg "hatched" end Purugin

Slide 49

Slide 49 text

...and so much more!

Slide 50

Slide 50 text

What Next?

Slide 51

Slide 51 text

No content

Slide 52

Slide 52 text

No content

Slide 53

Slide 53 text

Installing • Use your favorite Ruby installer • Linux packages • Windows installation from JRuby.org • Unpack, add to PATH

Slide 54

Slide 54 text

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!

Slide 55

Slide 55 text

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

Slide 56

Slide 56 text

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

Slide 57

Slide 57 text

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

Slide 58

Slide 58 text

Thank You! Charles Oliver Nutter [email protected] @headius http://jruby.org https://github.com/jruby/jruby