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

JRuby Everywhere! Bringing a world of opportuni...

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on.

JRuby Everywhere! Bringing a world of opportunities to the Ruby community

Delivered remotely at RubyJam in Taipei, April 14 2026

Avatar for headius

headius

April 14, 2026

More Decks by headius

Other Decks in Programming

Transcript

  1. @headius headius.com 㟬޷ʂ • Charles Oliver Nutter • "headius" on

    all the socials! • JRuby core developer since 2005 • Founder of Headius Enterprises • "The JRuby Company" • Thank you RubyJam! I hope I can visit in person again soon!
  2. @headius headius.com What is JRuby? • Ruby on the Java

    Virtual Machine • Ruby implementation fi rst, JVM language second • Many bene fi ts from JVM ecosystem • Ruby code should "just work" • Try your code, your library • If something doesn't work, let us know!
  3. @headius headius.com $ java -version openjdk version "26" 2026-03-17 OpenJDK

    Runtime Environment Zulu26.28+59-CA (build 26+35) OpenJDK 64-Bit Server VM Zulu26.28+59-CA (build 26+35, mixed mode, sharing) $
  4. @headius headius.com $ java -version openjdk version "26" 2026-03-17 OpenJDK

    Runtime Environment Zulu26.28+59-CA (build 26+35) OpenJDK 64-Bit Server VM Zulu26.28+59-CA (build 26+35, mixed mode, sharing) $ ruby-install jruby-10.0.5.0 >>> Updating jruby versions ... >>> Installing jruby 10.0.5.0 into /Users/headius/.rubies/jruby-10.0.5.0 ... >>> Downloading https://repo1.maven.org/maven2/org/jruby/jruby-dist/10.0.5.0/jruby- dist-10.0.5.0-bin.tar.gz into /Users/headius/src ... >>> Verifying jruby-dist-10.0.5.0-bin.tar.gz ... >>> Extracting jruby-dist-10.0.5.0-bin.tar.gz to /Users/headius/src/jruby-10.0.5.0 ... >>> Installing jruby 10.0.5.0 ... >>> Symlinking bin/ruby to bin/jruby ... >>> Successfully installed jruby 10.0.5.0 into /Users/headius/.rubies/jruby-10.0.5.0
  5. @headius headius.com $ irb >> RUBY_VERSION => "3.4.5" >> JRUBY_VERSION

    => "10.0.5.0" >> runtime = java.lang.Runtime.runtime => #<Java::JavaLang::Runtime:0x64a896b0> >> runtime.available_processors => 10 >> runtime.free_memory => 385494344
  6. @headius headius.com Ruby Compatibility • JRuby 10 supports Ruby 3.4

    • Language and core specs: 98% passing • Pure-Ruby standard library shared with CRuby • JRuby support for most native stdlib • Rails 8.x support is just about ready to release
  7. @headius headius.com Deploying JRuby • Puma works just fi ne!

    • Warbler: package app + libraries + JRuby in single fi le • WAR fi les for app servers, JAR fi les for standalone apps • Obfuscate code for commercial release • jruby-rack: Run any Rack-based app on any JVM app server • Embedding APIs: Script existing JVM app using Ruby
  8. @headius headius.com JVM Language • JRuby is a fi rst-class

    JVM language • Extensions are written in Java, not insecure C code • JVM can optimize Ruby code just like Java • JVM garbage collector is concurrent and ef fi cient • We write Java so you don't have to! • But you can if you want to! (or Scala, Clojure, Kotlin...)
  9. @headius headius.com JVM GC • Many options to tune JVM

    GCs • Heap size: small or large? • Throughput: faster allocations or shorter pause times? • Several GC algorithms in OpenJDK • G1, ZGC, Shenandoah, Parallel, Concurrent
  10. @headius headius.com JVM Performance • JRuby depends on JVM for

    most optimization • JVM has world-class JIT compilers, garbage collectors • Similar design to ZJIT, but with 30 years of work in it • JRuby itself has an IR, basic block-based interpreter and JIT • Similar design to ZJIT starting in JRuby 9.0 (2015)
  11. @headius headius.com Object.new 0M 3.5M 7M 10.5M 14M Object.new allocations

    per second 0M 13M 10.3M Ruby 3.4 + YJIT Ruby 4.0 + opt_new JRuby 10
  12. @headius headius.com Object.new 0M 56.25M 112.5M 168.75M 225M Object.new allocations

    per second 217.5M 13M 10.3M Ruby 3.4 + YJIT Ruby 4.0 + opt_new JRuby 10 🤯
  13. @headius headius.com JVM Concurrency • Ractors are designed to bring

    concurrency to Ruby • You must write Ractor-friendly code (immutable objects) • High overhead crossing Ractor boundary • Threads in JRuby are already 100% parallel • Immutable objects FTW • Low overhead for threads and shared memory
  14. @headius headius.com if THREADS queues = CONCURRENT.times.map { Queue.new }

    threads = CONCURRENT.times.map do |i| Thread.new do queue = queues[i] data_chunk = queue.pop data_chunk.each { |item| JSON.parse(item) } end end end
  15. @headius headius.com Threads vs Ractors 0 1.25 2.5 3.75 5

    times faster than linear 4.2x 1.2x 1.1x CRuby threads CRuby ractors JRuby threads
  16. @headius headius.com A World of Libraries • JVM ecosystem has

    tens of thousands of libraries • Graphics, GUIs, servers, document formats, AI/LLM • One of the largest collections in the dev world • All available to JRuby users! • Easy integration into Ruby apps and code • "Magic" to make Java APIs look like Ruby
  17. @headius headius.com Example: 3D Bar Chart with JFreeChart • Chart-generating

    library with support for document output • Easily used from JRuby • https://blog.headius.com/ 2025/05/3d-charts-and-more-with- jruby-and-jfreechart.html
  18. @headius headius.com java_import org.jfree.chart3d.data.StandardCategoryDataset3D java_import org.jfree.chart3d.data.DefaultKeyedValues ... require 'json' data

    = JSON.load(File.read("data/app_monitoring_revenue.json")) dataset = StandardCategoryDataset3D.new data.each do |name, subset| values = DefaultKeyedValues.new subset.each { values.put(_1, _2) } dataset.add_series_as_row name, values end
  19. @headius headius.com JRuby Users Say... "We use [JRuby] for running

    Ruby in environments without Ruby!" "[JRuby was] chosen to overcome MRI Ruby's lack of multithreading and to leverage the vast and mature ecosystem of Java" "JRuby has been integral to Poshmark's stack for over a decade and remains a cornerstone of scalability and innovation" - Quantum Inventions - LogStash - Poshmark "The JRuby team has been amazingly responsive and helpful!" - SubstituteAlert
  20. @headius headius.com JRuby 10.1 and Beyond • Many more optimizations

    coming! • Now that we are caught up, we can work on fun stuff • Reduced memory use, better JIT, better Java integration • JVM features to improve startup, fast native library integration • Liliput shrinks all objects • Leyden pre-JITs (AOT) JRuby and Ruby code • Upgrade JVM, your JRuby code runs faster!
  21. @headius headius.com Headius Enterprises • Expert support for your JRuby

    apps • New dev, migrations, upgrades • Bug prioritization, security SLAs • Help with your code under NDA • headius.com/welcome • Site by
  22. @headius headius.com Thank You! • Please contact me! • @headius

    on all the socials • [email protected] • JRuby Matrix chat • headius.com/welcome