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

Expand your Ruby Potential with JRuby

Expand your Ruby Potential with JRuby

JRuby is an implementation of Ruby 4.0 built on the Java Virtual Machine. For the past 20 years we've expanded the horizons of Ruby, bringing more jobs and more opportunities to Rubyists like you:

* High-scale applications needing shared-memory parallelism and big data
* Enterprise organizations with existing Java infrastructure
* Cross-platform, commercial-off-the-shelf (COTS) application packaging that protects your code
* Graphics-intensive applications including desktop, games, and visualization
* Mobile and embedded solutions using Android And you can do it all in Ruby, with no Java experience required!

This talk will review JRuby's history and show you what's possible when you bring the best of Ruby and the JVM together.

Delivered at RubyConf 2026 in Las Vegas, Nevada, USA

Avatar for headius

headius

July 14, 2026

More Decks by headius

Other Decks in Programming

Transcript

  1. @headius headius.com Hello RubyConf! • Charles Oliver Nutter ("headius") •

    20 years full-time JRuby dev • Co-founder of Headius Enterprises • "The JRuby Company" • I love Ruby, karaoke, and beer!
  2. @headius headius.com JRuby at RubyConf 2026 • Multiple ways to

    connect! • Main talk (you're here now) • Karaoke tonight • JRuby Hack Space tomorrow • JRuby Cabana on Thursday • We have STICKERS and T-SHIRTS! • How can JRuby help you?
  3. @headius headius.com My Journey to Ruby • 1996-1998: University of

    Minnesota • Java applets, web-based registration system • 1998-2002: Senior Java Developer at various jobs • 2002-2006: Java Enterprise Architect!
  4. RubyConf 2004 • My fi rst Ruby conference • I

    didn't even know Ruby! • Hallway hacking: Rake, RubyGems • Pickaxe 2 released by PragProg • A total of 65 attendees!
  5. @headius headius.com The Road to Rails • JRuby in 2005:

    Nothing worked! • Started with basic tools • Ran every test we could fi nd, wrote our own • Ruby on the JVM is really hard • In other words... challenge accepted!
  6. @headius headius.com The Road to Rails • 2005-2006: tons of

    work for Rails • IRB, Rake, RubyGems, core libs • Early 2006: IT WORKS! • But it's SUPER SLOW! 😂 • Still in development mode! 🤦 • JavaOne 2006 • 1800 people in the room! • Full-time JRuby work at Sun Microsystems!
  7. @headius headius.com JRuby = Opportunity • Ruby is amazing, but

    has many challenges • C extensions break optimization • Real world needs parallelism, big data • Ruby ecosystem missing functionality • JRuby is enterprise-ready! • JVM is trusted, optimized, parallel, scalable
  8. @headius headius.com Optimizing Objects • CRuby 4 added opt_new to

    optimize Class#new • Using C code to allocate + initialize is hard to optimize • JRuby implemented in 2016 • Normal Class#new: allocate and call #initialize directly • Everything can inline and optimize
  9. @headius headius.com World-class GCs • Highly tunable • Heap size:

    small or large? • Throughput: faster allocations or shorter pause times? • Working set: large in-memory or mostly new objects? • GC probably will never be your problem • ...and if it is, we have the tools to help!
  10. @headius headius.com Generate mandelbrot bitmap, time per iteration (lower is

    better) ms CRuby 4 YJIT JRuby JRuby + Graal JIT 152ms 277ms 652ms
  11. @headius headius.com Roundhouse • Compile your Rails code to an

    optimized application • Reduce dynamism to run faster • Multiple backend targets • Ruby, Crystal, Rust, Kotlin • See Sam Ruby's talk Thu at noon!
  12. @headius headius.com User Focus: Logstash • Open-source data processing engine

    in the Elastic stack, for logging, observability, and security • JRuby user since 2012 • Hundreds of thousands of events per second using JRuby's multithreading • Integration with Java libraries and servers • Core queue in Java with integration and plugins handled by JRuby • Deployed as JVM-based package across all platforms • https://www.elastic.co/logstash "[JRuby was] chosen to overcome MRI Ruby's lack of multithreading and to leverage the vast and mature ecosystem of Java"
  13. @headius headius.com Concurrency + Isolation • JRuby Threads are 100%

    parallel • Low overhead for threads and shared memory • Ractors only work with immutable objects • JRuby can run multiple instances • Full isolation combined with full parallelism
  14. @headius headius.com puts "single-threaded version" 10.times do t = Time.now

    100.times.map do JSON.parse File.read(".../1MB.json") end puts Time.now - t end
  15. @headius headius.com puts "Thread version" 10.times do t = Time.now

    10.times.map do Thread.new do 10.times do JSON.parse File.read(".../1MB.json") end end end.each(&:join) puts Time.now - t end
  16. @headius headius.com puts "Ractor version" 10.times do t = Time.now

    10.times.map do Ractor.new do 10.times do JSON.parse File.read(".../1MB.json") end end end.each(&:join) puts Time.now - t end
  17. @headius headius.com Threads vs Ractors 0 1.5 3 4.5 6

    6x 3.7x 1.6x CRuby threads CRuby ractors JRuby threads
  18. @headius headius.com User Focus: Poshmark • Leading social commerce marketplace

    with millions of users • High concurrency and heavy transaction volumes daily • Leveraging JVM ecosystem for resilience, growth, and scaling • Migrating to MongoDB Java driver reduced p50 by 30% and p95 by 35% • https://poshmark.com/ "JRuby has been integral to Poshmark's stack for over a decade and remains a cornerstone of scalability and innovation"
  19. @headius headius.com A World of Libraries • JVM ecosystem has

    hundreds of thousands of libraries • Graphics, GUIs, servers, document formats, ML/AI/LLM, ... • All available to JRuby users! • Easy integration into Ruby apps and code • "Magic" to make Java APIs look like Ruby • Never write a single line of Java!
  20. @headius headius.com JFreeChart • Chart-generating library with multiple output formats

    • Easily used from JRuby • https://blog.headius.com/ 2025/05/3d-charts-and-more-with- jruby-and-jfreechart.html
  21. @headius headius.com Dependencies • Jar fi le for JVM deps

    • Like Bundler's Gem fi le • Maven "coordinates" • lock_jars command • Like `bundle install` jar 'org.jfree:jfreechart:1.5.5' jar 'org.jfree:org.jfree.chart3d:2.1.0' $ lock_jars -- jar root dependencies -- org.jfree:jfreechart:1.5.5:compile org.jfree:org.jfree.chart3d:2.1.0:compile org.jfree:org.jfree.svg:5.0.6:compile org.jfree:org.jfree.pdf:2.0:compile Jars.lock updated Jar fi le
  22. @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
  23. @headius headius.com Glimmer • Ruby DSL for GUI applications •

    Multiple backends (SWT, GTK, ...) • Cross-platform GUI is easy with JRuby! • Deployable everywhere • GUI libraries shipped with application • https://github.com/AndyObtiva/glimmer
  24. @headius headius.com Native Library Support • Ruby Foreign Function Interface

    (FFI) • Pure-Ruby code to bind and invoke native functions • Optimized by JVM • Web Assembly (WASM) • Deploy gem as a WASM build, execute with JVM WASM runtime • Used by Prism parser, RBS gem, more coming soon
  25. @headius headius.com User Focus: Kami • An interactive, accessible learning

    platform with intentional AI, actionable insights, and inclusive tools for students and teachers • Scaling Ruby for high-throughput workloads (millions of PDFs per day) • Access to the vast library of Java document, image, and PDF libraries • Uni fi ed Ruby experience across project teams • https://www.kamiapp.com/
  26. @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
  27. $ cat README.md # Sidekiq::Warbler A simple demo wrapper for

    Sidekiq to support Warbling. ## Usage Just bundle and run `bundle exec rake jar` to produce an executable sidekiq.jar. $ cat config/warble.rb Warbler::Config.new do |config| config.jar_name = "sidekiq" config.executable = ["sidekiq", "bin/sidekiq"] end $ bundle exec rake jar rm -f sidekiq.jar Creating sidekiq.jar
  28. $ java -jar sidekiq.jar -r ../examples/por.rb m, `$b .ss, $$:

    .,d$ `$$P,d$P' .,md$P"' ,$$$$$b/md$$$P^' .d$$$$$$/$$$P' $$^' `"/$$$' ____ _ _ _ _ $: ',$$: / ___|(_) __| | ___| | _(_) __ _ `b :$$ \___ \| |/ _` |/ _ \ |/ / |/ _` | $$: ___) | | (_| | __/ <| | (_| | $$ |____/|_|\__,_|\___|_|\_\_|\__, | .d$$ |_| INFO 2026-07-14T18:48:47.849Z pid=60202 tid=195a: Running in jruby 10.0.2.0 (3.4.2) 2025-08-07 cba6031bd0 OpenJDK 64-Bit Server VM 25+36-LTS on 25+36-LTS +indy +jit [arm64-darwin] INFO 2026-07-14T18:48:47.850Z pid=60202 tid=195a: See LICENSE and the LGPL-3.0 for licensing details. INFO 2026-07-14T18:48:47.850Z pid=60202 tid=195a: Upgrade to Sidekiq Pro for more features and support: https://sidekiq.org INFO 2026-07-14T18:48:47.852Z pid=60202 tid=195a: Sidekiq 8.0.8 connecting to Redis with options {size: 10, pool_name: "internal", url: nil} INFO 2026-07-14T18:48:47.878Z pid=60202 tid=195a: Sidekiq 8.0.8 connecting to Redis with options {size: 5, pool_name: "default", url: nil} INFO 2026-07-14T18:48:47.880Z pid=60202 tid=195a: Starting processing, hit Ctrl-C to stop
  29. @headius headius.com User: Quantum Inventions • Software for intelligent transport

    systems, focusing on smart city mobility and fl eet mobility as a service. • Rails-based GUI apps deployed on- premises with Oracle DB and WebLogic • User-acceptance testing using packaged JRuby apps within customer environments • Ruby-based data processing packaged as JRuby apps run by customers • https://quantuminventions.com/ "We use [JRuby] for running Ruby in environments without Ruby!"
  30. • Open-world exploration, construction, and combat game available on Steam

    • DragonRuby used for front-end graphics • World management handled by JRuby backend •
  31. @headius headius.com The Tip and the Tail • JRuby 10.0

    is our LTS line (the tail) • Supported in OSS until 2028 • JRuby 10.1 is our experimental line (the tip) • Move fast and break things • ...but also try out advanced optimizations sooner • JRuby 10.2 will be the next LTS (Ruby 4.1 compatible)
  32. @headius headius.com Steady Improvements • Advanced object shaping: right-size objects

    • Specialized String shapes: single chars, embedded, Java wrapper • Specialized Arrays: concurrent, trees, primitive values • Specialized Hashes: compact forms, concurrent, primitive values • All arguments on stack: eliminate array/hash boxing of args
  33. Maintaining JRuby • JRuby remains 100% Open Source Software •

    One self-funded developer, many community members • We need your support! • Try JRuby and help us improve • Present JRuby to your companies • Sponsor a JRuby developer to keep working
  34. @headius headius.com JRuby Support • Expert support for your JRuby

    apps • New dev or pilot projects • App migrations and upgrades • Bug prioritization and security SLAs • Help with your app under NDA • "Virtual Team Member" • headius.com/welcome
  35. @headius headius.com Thank You! • Please get in touch! •

    @headius on socials • [email protected] • JRuby Matrix chat • JRuby support • headius.com/welcome • JRuby at RubyConf 2026 on Eventify!