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!
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!
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!
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
• 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!
• 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
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!"
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...)
• 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
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"
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
• 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
"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)
"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)
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
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/
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!
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
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"
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!"
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!