JRuby: A High-Performance, Open-Source Implementation of Ruby for the JVM

Jruby Implements The Ruby Language Atop The Jvm

TL; DR: We spoke with JRuby Co-Lead Developer Charles Nutter on JRuby’s journey during the COVID-19 pandemic, the open-source community, and the implementation’s compatibility and performance. JRuby released its latest version, JRuby 9.4, in November 2022 to match compatibility for applications that run on Ruby 3.1. Although the JRuby team plans to augment performance this year, JRuby remains the fastest way to run most Rails applications and provides top-notch scalability for large workloads.

When Charles Nutter, the Co-Lead Developer of JRuby, first encountered the JRuby project, he was attending the Ruby Conference in 2004. The project was in its third year after launching in late 2001. Java was Charles’ primary development language, so he wasn’t very familiar with Ruby. But everything changed after the Ruby Conference.

“I fell in love with the language and the community, and everybody enjoyed it. So while I was sitting at the conference, I looked up to see if there was a JRuby project I could use as a JVM Java guy. And it turned out the project did exist,” said Charles.

JRuby Logo
JRuby offers an implementation of Ruby atop the JVM for better scalability and performance.

Little did he know that his longtime friend Thomas Enebo was at the helm of the JRuby ship. Once he knew the leadership contact, he emailed Tom and started with the JRuby team as a Co-Lead Developer in 2005. At the time, Ruby on Rails began picking up steam and reshaping how people built web applications. The JRuby team shared the belief that it, too, could transform web development for everyone.

“We had this nascent Ruby implementation that needed a lot of work but believed had the potential to run all of these same applications and bring that same paradigm shift to JVM-based developers. And we got great feedback from the community,” said Charles.

Charles and Tom later managed to get Ruby on Rails to run on their software and route requests. And within the first year of that addition, Sun Microsystems, the creator of the Java programming language, reached out to the team to collaborate on JRuby and bring other languages to the platform. From there on, JRuby has been on the journey it is on today, although it hasn’t been without its challenges.

Ensuring Compatibility for Every New Ruby Release

In its more than 20 years in the industry, JRuby has experienced many changes in the Ruby, Java, and web development landscape. The team also had challenges, including resistance from the developer community early on in JRuby’s infancy.

“A lot of folks in the Ruby community were ex-Java developers, and they were not super excited to see a Java project sneaking up into their new fun territory. But over time, they’ve warmed up to us, and we managed to bring them around,” said Charles.

The Ruby programming language also lacked testing and specifications. Ruby developers hadn’t implemented testing for every Ruby feature within its test suite. So the JRuby team had to incorporate multiple user-created test suites and run testing from key libraries to ensure compatibility.

A View of the JRuby Implementation
The JRuby implementation increases performance and scalability while giving users access to Java libraries.

“The compatibility challenges have always kept us guessing what new features we’re going to implement and what difficult language changes we will have to make. And we’ve managed to keep up,” said Charles.

JRuby’s latest release, the 9.4, came out in fall 2022. This release was the team’s first update in a couple of years since JRuby’s development had slowed down due to the COVID-19 pandemic.

“That release jumped Ruby compatibility from Ruby 2.6 all the way through to 2.7, 3.0, and 3.1. So there were a lot of new features to implement because it took us a couple of years to do all that. But the response has been really good,” said Charles.

Joining Conferences and the Open-Source Community

Conferences have long been a staple of the JRuby community, as far back as Charles’s start with the project through the Ruby Conference 2004. Charles said he often does presentations at conferences and meets tons of people. He also shared that conferences play a significant role in JRuby’s development road map.

“You get so much energy by meeting with people that are using your project. And it gives you a reason to keep working on it,” said Charles.

For example, Charles told us he met a team that used Ruby to build a remote sparring partner robot for kickboxing at a Ruby conference. During the team’s demonstration, they explained how they used three different Ruby implementations to create their solution. The team used mruby to run the robot, CRuby to drive the server, and JRuby to build an Android frontend application, which Charles helped them with the night before the conference.

During the COVID-19 pandemic, the JRuby team couldn’t attend Ruby conferences in person, so that made development and road map inspiration more challenging. But the JRuby team still received contributions from several open-source community members.

“Two of us work full-time for Red Hat, which currently sponsors the project. Outside of that, there are probably a dozen people that cycle in and out of the project and a core of four to six people fixing bugs and providing patches,” said Charles.

The open-source community has shifted throughout the years, especially in its relationship with JRuby. Earlier in JRuby’s life cycle, most developers were more interested in the Java side and how to use Ruby to script Java applications using Rails as their frontend framework. Now that more web app frameworks are available for Java, more of JRuby’s contributors are coming from the Ruby side to leverage the capabilities of the Java platform.

“They are looking for performance, scaling, garbage collection, and the entire set of libraries available with Java. So it’s being driven much more from the Ruby side of the community now, which I think has helped keep us in touch with what’s going on there,” said Charles.

Playing Catch-up With Performance After COVID-19

Although the COVID-19 pandemic made development more challenging, the JRuby team has done an excellent job at remaining up-to-date with the latest Ruby releases. The team is currently working on its compatibility for the latest Ruby release, Ruby 3.2, which occurred in December 2022.

“By the end of the year, we will bring Ruby 3.2 compatibility. There’s also a couple of features of Ruby 3.1 that we’re still filling out that will help with high scaling servers and hundreds of 1000s of requests in a single process,” said Charles.

JRuby also works with the core Ruby team on new feature releases by offering input and monitoring what’s getting added or rejected. Since 2004, Ruby has changed how it does its testing and specification, which has made it easier to do compatibility testing. Now JRuby can check its bulleted list of new features and go from there.

Charles told us now that since JRuby has caught up on compatibility, the team can finally return its focus to performance. The team hasn’t had the chance to do so in the last two to three years, so team members are excited about the possibilities and the new capabilities JRuby can offer. Charles also said JRuby is still the fastest way to run most Rails applications and is ideal for scaling large apps.

“If your system is large enough and you have enough concurrent users, we start to win quickly on using the resources the best, leveraging all the CPUs in the system, and can handle more requests with the same amount of memory. And that translates into real savings for Ruby users that can move to JRuby,” said Charles.