With JRuby, you can build cross-platform desktop apps, scalable server apps, and Android mobile apps. Charles Oliver Nutter will show you how to make it happen — and have fun along the way!
Presented June 13, 2025 at Baltic Ruby in Riga, Latvia
reporting and business intelligence • Integration with the whole Atlassian stack • I'm here because of them! • Sponsor of Baltic Ruby • Sponsor of my trip to Riga
• Ruby implementation fi rst, JVM language second • Many bene fi ts from JVM ecosystem • Ruby code should "just work" • JVM-based extensions (no need for C build tools) • Parallel threading (no need to fork) • Thousands of production users, 18 years of real-world use
challenges! • YJIT/ZJIT: JRuby added JIT in 2008 • Deoptimization, saving JIT code: JVMs already can do this • Class.new optimization: since 2015 • Namespaces for isolation: always! • We move fast and help solve Ruby's problems!
Kotlin, Scala, Clojure • Mobile platforms built on Android • TVs, POS, control terminals • Desktop applications • 68% of of fi ce work done on desktops
and core specs: 98% passing • Pure-Ruby standard library shared with CRuby • JRuby support for most native stdlib • JRuby 9.4 supports Ruby 3.1 • Maintained until April 2026
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
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
...) • JRuby + SWT is the most mature • JRuby makes cross-platform GUI much easier! • Works same everywhere • GUI libraries shipped with gem • https://github.com/AndyObtiva/glimmer
Heap size: small or large? • Throughput: faster allocations or shorter pause times? • Working set: large in-memory or mostly new objects? • Many options in standard OpenJDK • Serial, Parallel, G1, ZGC, Shenandoah
C1 "client" JIT: fast, simple optimizations • C2 "server" JIT: needs pro fi le data, heavy optimization • Both enabled with various "tiers" of JIT • Graal JIT: newer, more aggressive optimizations • OpenJ9 JIT (IBM JDK): of fl ine AOT, JIT servers, CRIU
basic JVM monitoring • JDK Flight Recorder: always-on monitoring with pro fi ling options • Low-overhead 1% to 5%, built into OpenJDK • JDK Mission Control: GUI client for Flight Recorder data • https://adoptium.net/jmc/
• 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)
Using C code to allocate + initialize hurts performance • JRuby implemented this in 2016 • If Class#new is default, allocate and call #initialize inline • Allocation and initialize both inline back to caller
• Literal symbol form is by far the most common • Currently compiled as a call to respond_to? • respond_to? then does a method lookup every time • Can we do better?
threads, so we need worker processes • Processes duplicate runtime state and waste resources • JRuby is a good solution • Multi-threaded single process runs your entire site • Single process with leading-edge GC uses resources better
Additional users only require a little more memory • CRuby single-user: 103MB RSS • Additional users eventually need additional processes • Even perfect Copy-On-Write still duplicates live data, JIT, GC
to Ruby • You must write Ractor-friendly code • High overhead crossing Ractor boundary • Threads in JRuby are already 100% concurrent • You must right Thread-friendly code • But zero overhead due to shared object • Thanks to Maciej Mensfeld for the benchmark
we are 3.4 compatible, we can work on fun stuff • If you fi nd something that's slow, let us! • More JDK features • JVM features to improve startup, fast native library integration • Upgrade JVM, your JRuby code runs faster!
support: updates, bugs, security • JVM, Ruby support: pro fi ling, optimization • Partner with us! • User support • GitHub sponsorships • Try JRuby out, fi le issues, push PRs