Share
Embed
Expand Your Ruby With JRuby!
JRuby is more than Ruby for JVM! Optimize your code, max out cores, deploy single-file apps, build portable GUIs and more. It's fun and easy with JRuby!
headius
March 27, 2026
Transcript
54 slides
-
Expand your Ruby with JRuby! Bringing a world of opportunities
to the Ruby community -
@headius headius.com Howdy! • Charles Oliver Nutter ("headius") • Full-time
JRuby dev since 2006 • Co-founder of Headius Enterprises • "The JRuby Company" • Excited to be back in Austin! • Keep Ruby Weird 2016 -
@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! -
@headius headius.com JRuby Users Worldwide • Thousands of applications running
JRuby • Production users since 2007 • Only alternative Ruby to see widespread production use! • I will showcase a few users today • Each user could not use Ruby without JRuby • Add your use case! -
@headius headius.com JRuby = Opportunity • Ruby can be hard
to sell to large companies! • They don't want another runtime • C code is insecure, needs C compiler • Ruby ecosystem missing many libraries • Real world demands parallelism • JRuby is enterprise-ready! • JVM is trusted, secure, parallel, scalable -
@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) $ -
@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.4.0 >>> Updating jruby versions ... >>> Installing jruby 10.0.4.0 into /Users/headius/.rubies/jruby-10.0.4.0 ... >>> Downloading https://repo1.maven.org/maven2/org/jruby/jruby-dist/10.0.4.0/jruby- dist-10.0.4.0-bin.tar.gz into /Users/headius/src ... >>> Verifying jruby-dist-10.0.4.0-bin.tar.gz ... *** No md5 checksum for /Users/headius/src/jruby-dist-10.0.4.0-bin.tar.gz >>> Extracting jruby-dist-10.0.4.0-bin.tar.gz to /Users/headius/src/jruby-10.0.4.0 ... >>> Installing jruby 10.0.4.0 ... >>> Symlinking bin/ruby to bin/jruby ... >>> Successfully installed jruby 10.0.4.0 into /Users/headius/.rubies/jruby-10.0.4.0 -
@headius headius.com $ irb >> RUBY_VERSION => "3.4.5" >> JRUBY_VERSION
=> "10.0.4.0" >> runtime = java.lang.Runtime.runtime => #<Java::JavaLang::Runtime:0x64a896b0> >> runtime.available_processors => 10 >> runtime.free_memory => 385494344 -
@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 • JRuby 10.1 supports Ruby 4.0 • Releasing any day now! -
@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 -
@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!" -
@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...) -
@headius headius.com JRuby Architecture Ruby (.rb) JIT Java Instructions (java
bytecode) Ruby Instructions (IR) parse interpret interpreter interpret C1 compile native code better native code java bytecode interpreter execute C2 compile Java Virtual Machine JRuby Internals -
Class#new Optimization • CRuby 4 added opt_new to optimize Class#new
• Using C code to allocate + initialize was hard to optimize • JRuby implemented this in 2016 • If Class#new is default, allocate and call #initialize directly • Allocation and #initialize both inline back to caller -
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 -
0M 75M 150M 225M 300M Object.new allocations per second 217.5M
13M 10.3M Ruby 3.4 + YJIT Ruby 3.5 + opt_new JRuby 10 🤯 -
@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" -
@headius headius.com Problem: Ruby is missing a library or it
isn't cross-platform -
@headius headius.com A World of Libraries • JVM ecosystem has
hundreds of thousands of libraries • Graphics, GUIs, servers, document formats, ML/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 -
@headius headius.com Example: 3D Bar Chart with 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 -
@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 -
@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 -
@headius headius.com chart = Chart3DFactory.create_bar_chart( "Quarterly Revenues", "Application & Performance
Monitoring Companies", dataset, nil, "Quarter", "$million Revenues") chart.chart_box_color = Color.new(255, 255, 255, 127) chart.legend_anchor = LegendAnchor::BOTTOM_RIGHT -
@headius headius.com Generate PNG width, height = 600, 500 category_chart_image
= BufferedImage.new(width, height, BufferedImage::TYPE_INT_RGB) category_chart_graphics = category_chart_image.create_graphics chart.draw(category_chart_graphics, Rectangle.new(width, height)) category_chart_file = File.open("category_chart.png", "w") ImageIO.write(category_chart_image, "PNG", category_chart_file.to_outputstream) -
@headius headius.com SDL in JRuby! version = "3.4.1" natives =
"natives-macos-arm64" jar "org.lwjgl:lwjgl:#{version}" jar "org.lwjgl:lwjgl-sdl:#{version}" jar "org.lwjgl:lwjgl:#{version}:#{natives}" jar "org.lwjgl:lwjgl-sdl:#{version}:#{natives}" require 'jar-dependencies' version = '3.4.1' natives = 'natives-macos-arm64' require_jar 'org.lwjgl', 'lwjgl', version require_jar 'org.lwjgl', 'lwjgl-sdl', version require_jar 'org.lwjgl', 'lwjgl', natives, version require_jar 'org.lwjgl', 'lwjgl-sdl', natives, version java_import org.lwjgl.sdl.SDLMessageBox SDLMessageBox::SDL_ShowSimpleMessageBox( SDLMessageBox::SDL_MESSAGEBOX_INFORMATION, "Hello, world", "Hello from LWJGL's SDL bindings!", 0) -
@headius headius.com JragonRuby! version = "3.4.1" natives = "natives-macos-arm64" jar
"org.lwjgl:lwjgl:#{version}" jar "org.lwjgl:lwjgl-sdl:#{version}" jar "org.lwjgl:lwjgl:#{version}:#{natives}" jar "org.lwjgl:lwjgl-sdl:#{version}:#{natives}" require 'jar-dependencies' version = '3.4.1' natives = 'natives-macos-arm64' require_jar 'org.lwjgl', 'lwjgl', version require_jar 'org.lwjgl', 'lwjgl-sdl', version require_jar 'org.lwjgl', 'lwjgl', natives, version require_jar 'org.lwjgl', 'lwjgl-sdl', natives, version java_import org.lwjgl.sdl.SDLMessageBox SDLMessageBox::SDL_ShowSimpleMessageBox( SDLMessageBox::SDL_MESSAGEBOX_INFORMATION, "Hello, world", "Hello from LWJGL's SDL bindings!", 0) -
@headius headius.com Glimmer • Ruby DSL for GUI applications •
Multiple backends (SWT, GTK, ...) • JRuby + SWT is the most mature • Cross-platform GUI is easy with JRuby! • Deployable everywhere • GUI libraries shipped with application • https://github.com/AndyObtiva/glimmer -
@headius headius.com JRuby on Android • Ruboto: JRuby framework for
Android • Build apps using Ruby! • Ruboto IRB: demo application • "Ruboto Core" and "Ruboto IRB" APKs • Used in production apps for years • Help us update for latest JRuby, Android -
@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/ -
@headius headius.com Solution: JVM is designed for big data and
high concurrency -
@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! -
@headius headius.com Concurrency + Isolation • Ractors are designed to
bring concurrency to Ruby • JRuby Threads are already 100% parallel • Low overhead for threads and shared memory • Box (Ruby 4.0) for isolating namespaces, loaded fi les • JRuby can run multiple instances in a single process -
@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 -
@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 -
@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" -
@headius headius.com User Focus: SubstituteAlert • Leading tool for substitute
teacher alerts and assignment • JRuby user since 2013 • Real concurrency for highly-parallel backend that would be hard in CRuby • Java integration with Firebase for Android noti fi cations • Better performance pro fi ling tools for JVM • https://www.subalert.com/ "The JRuby team has been amazingly responsive and helpful!" -
@headius headius.com "JRuby is excellent. I don't even code for
MRI anymore and don't miss it." - "G. Gibson" on JRuby's Matrix chat -
@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! -
@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 -
@headius headius.com Let's Talk! • Questions during break, meetup after
• Building an app? • Try to run on JRuby • Library author? • Add JRuby to CI • Report any issues • Take some stickers home! -
@headius headius.com Thank You! • Please get in touch! •
@headius on socials • [email protected] • JRuby Matrix chat • headius.com/welcome • USERS.md