Tuesday, March 06, 2007

Behind The Scenes: JRuby 0.9.8 Released!

Things have been moving quickly in JRuby-land, and we've just kicked out a major release in JRuby 0.9.8. Among the big features:

  • Ruby classes can extend concrete/abstract Java classes and override methods
  • New Java primitive array syntax
  • Reimplementation of String, Numeric classes, and Array to be more correct and performant
  • Significant bottlenecks have been identified. In some cases IO is 6.5x faster than previous releases. Java included classes are significantly faster than in the past.
  • 220 Jira issues resolved since last release
Now these are certainly delicious. Performance improvements are always great, and we're been improving Java integration little by little. But there's another bullet I omitted that is worth a little more attention:
  • Ruby on Rails support
Now you may feel free to read that as you wish. I read it as "we expect pure-Ruby Rails apps to work." By "pure Ruby", I mean no unsupported C-language extensions required. By "work" I mean "work."

It was our original plan over two months ago that by Februrary's end we'd be passing enough of Rails' own test cases to call it "supported". And in a relative rarity for an open source project, we hit that milestone. It was actually early last week we started saying we officially support Rails, which at the time meant better than 95% of Rails test cases passing. By the time we cleaned up the remaining release items, we had passed 98%. And we're still climbing.

So what does this mean for a practical Rails user? Well, it means that the dream of deploying Rails apps on any Java-based server in any Java-based organization is another big step closer to coming true. I've actually been demoing Rails apps running in a WAR file on GlassFish for all my recent talks, and it's pretty solid. I don't imagine it's perfect, of course, but it's looking really very good. It will be "ready" by the time we hit 1.0.

A few folks have been wondering about the jump from JRuby 0.9.2 to JRuby 0.9.8. The simple answer is this: we're two releases away from 1.0. We wanted to make it obvious how much work has gone into 0.9.8 (as many SVN revisions in this release as the last three combined) and show our commitment to getting a 1.0 release out very soon. The 0.9.8 release will be followed by 0.9.9, which will be followed by...well, you get the picture. We're in the home stretch now.

The other core team members have reported on the release, so I won't cover all that. Here's a list of links:

Tom Enebo
Ola Bini
Nick Sieger

In related news, there's also a new release of ActiveRecord-JDBC, the gem-installable module enabling JDBC databases to be used by ActiveRecord. This is also very welcome, since there have been a number of bug fixes in trunk that weren't easily installable the past couple months. Now you should be able to run both Rails 1.2.2 and 1.1.6 well with JRuby, just using released code. It helps complete the puzzle.

So what's next for JRuby? Well, with the 0.9.8 release we've reached a really big milestone as far as Ruby compatibility, so we're likely to turn our attentions toward areas not directly related to Ruby 1.8. Specifically:
  • Work will continue on the bytecode compiler, and I'm hoping to have the JIT permanently enabled within the next week
  • Java integration will get a heavier focus, to start bringing us more in line with languages like Groovy for ease-of-integration. In general things are looking pretty solid right now, but we know there's a lot of work to do here. I'd like for us to come as close as possible to Groovy's level of tight integration as possible.
  • We will also start working on native Unicode support, by exposing a Chars class like the one provided in Rails' MultiByte library. This will allow us to maintain compatibility with Ruby and provide solid Unicode support without introducing an incompatible set of features.
  • Both Tom and Ola have expressed an interest in continuing work on our Ruby 2.0 bytecode engine. Ola would like to continue improving and expanding the bytecode support, while Tom would like to play with a second parser that goes straight to bytecode. Both of those will help feed into a potentially faster interpreted mode in the future, giving us many of the perf gains shown in Ruby 1.9 benchmarks.
For me personally, performance is going to be the big item. The recent Ruby Shootout showed that we have some work to do to bring out performance up to MRI standards, but it didn't tell the whole story. The truth of the matter is more like this:
  • JRuby interpreted mode is roughly 3-4x as slow as Ruby 1.8
  • JRuby compiled mode is roughly 1.5-2x faster than Ruby 1.8
  • KRI (Ruby 1.9, "Koichi's Ruby Implementation") is many times faster than MRI for the posted benchmarks
  • KRI is 2x or less faster than MRI for the general case
And this is without us doing any optimization of the compiler or adding in any special-case optimizations like KRI provides for fixnums. We're still looking great for future performance, and I want to start tackling this area heavily over the next couple months.

As always, we welcome contributors, bug reports, patches, and user anecdotes for JRuby. We love to hear about bugs, we want to know your opinion, and we respect and honor our community whenever we get the chance. Remember, JRuby is your project, and can only be successful with your help.

Visit www.jruby.org to learn more about the project, download the release, and get involved!

On to the next release!


Bruno said...

Way to go Charles! Congratulations!

Anonymous said...

Great job. I enjoyed your world tour blogs too. Would the AOT compiler be part of the 1.0 release?

Charles Oliver Nutter said...

Anonymous: I'd love to have the AOT compiler done by the 1.0 release, but it's not as high a priority as having the JIT working well and general performance running faster than MRI. Complete, flawless AOT compilation of Ruby is quite complicated, and I don't plan on delaying the 1.0 release to finish the last 5 or 10% of really hard compiler features.

Marcus Bristav said...

Nice work and congrats!

A thing I've been wondering regarding Rails, java and java app servers (or serlvet containers): In real world Rails applications you have to deploy several server processes to handle parallell requests due to Rails non-thread safety. How is this supposed to be handled with java app servers? I mean, you can't really deploy a ton of JBoss, Tomcats or even Jettys.

So how are Rails applications really supposed to work on the java platform?


Charles Oliver Nutter said...

Marcus: Basically, instead of having multiple processes, a Rails app deployed to an app server would have multiple JRuby runtimes to handle the requests. This is far lighter-weight, easier to manage, and it will scale to the load. You certainly don't need to have multiple app server instances, although if you choose to do that (i.e. through clustering) you will have that option too :)

sputnik62 said...

You guys made amazing progress on JRuby!

Quick question on the footprint. If you are going to load multiple JRuby run-times, would each run-time drag in its own copy of JVM?

We are doing some heavy duty performance testing of DB2 on Rails (see http://db2onrails.com)and I would really like to see the difference in capacity between Ruby on Rails and Mongrel and JRuby.

Raphael said...

Congrats for this new release. I'm happy tighter Java integration will get a higher priority, as my primary interest for JRuby is to have access to the enormous amount of Java libraries from Ruby.


Geoff said...

I was the guy at No Fluff telling you that jruby wouldn't run the Metakoans Ruby Quiz code. Well, I'm glad to report the latest version does!