Chris Umbel

Ruby in my Enterprise with JRuby Thanks to JRubyConf

JRuby logo Last weekend I went to JRubyConf and had a blast. I left armed with some new knowledge, some new contacts and a new academic appreciation for /whiske?y/. One of the best parts is that I really only had to pay for the hotel because I won the ticket at a Pittsburgh Ruby Brigade meeting.

Now, even though I was attending a JRuby conference I wasn't really all that familiar with JRuby itself. Of course I understood that it was a port of Ruby to the JVM thus facilitating use of existing Java code. I understood that JRuby has favorable concurrency characteristics due to the lack of a global interpreter lock. But I always assumed it was generally immature and difficult to work with.

Wow, was I wrong. It turns out that it's robust, solves many of the Ruby (and Rails) problems I've been having and simplifies tasks I figured I'd have to simplify myself.

It only took two key advantages for me to turn our rails department on a dime and start JRuby adoption: great x64 windows support and .war file deployment of rails apps.

Excellent 64-bit Windows Support

This took me off guard and I felt very stupid for not thinking of it earlier. JRuby runs great on every meaningful, modern platform within my enterprise. This stems from the proliferation of perfectly solid 100% pure Java libraries and drivers that exist for nearly any task including rock solid JDBC drivers for database connectivity.

Personally, I only use 64-bit macs and 32-bit linux boxes at the office, but a number of people who contribute to my projects are using 64-bit Windows machines, and... well... aren't going to change. Even though the MRI's quite happy on the platforms I use personally many gems that involve native code have proven to be unstable on Windows x64 thus screwing my coworkers (therefore annoying me). For instance it took quite a bit of hacking around to get a working mysql gem on my boss's workstation even though other x64 windows machines seemed to be ok with the same libmysql.dll.

With JRuby I never had to worry about it. I used a rock solid JDBC driver with an ActiveRecord adapter and every machine everywhere was happy... Happy and FAST!

I guess I always operated under the assumption that the MRI was as portable as Ruby runtimes will get. At its core it's pretty portable I suppose, but it's crippled by severe reliance on native code extensions. JRuby, however, is largely free of such concerns as the Java extensions are plenty fast enough and incredibly portable.

Easy .war File Deployment of Rails Applications

I was also caught off guard by JRuby on Rails' capacity to deploy applications as .war files.

My surprise is somewhat more understandable here, though. I'm not really a Java guy despite having been immersed in it recently. Sure, I hacked out plenty of Java from 1995-ish to 2001-ish but my head was never in Java Servlet-based web apps. I've only deployed other people's .war files, namely Solr, which felt more third-party-appliance-like. It wasn't something I was looking for and therefore didn't know that I wanted it.

As soon as I heard a speaker indicate I could wrap up the JRuby runtime itself along with whatever gems my rails project needs with a single “warble” command I was sold. That's some easy deployment!

All you have to do is install the warbler gem

jruby -S gem install warbler

and then type


in your rails project's directory. A .war file will then be produced that you can deploy into the servlet container of your choice.


These two pieces of knowledge have already had a wonderful impact on productivity at the office and it's barely been a week. Even if I had to pay for the ticket it would have been worth it.

Thu Oct 07 2010 04:36:20 GMT+0000 (UTC)

Follow Chris
RSS Feed