ClockingIT – JRuby 1.1.5/1.1.6RC1 vs MRI Benchmark

December 4, 2008

As I’ve ported ClockingIT to use Sphinx/Ultrasphinx instead of ferret/acts_as_ferret, I figured I’d give jruby a shot to see how it compared to MRI when running ClockingIT. I’ve wanted to do this for a long time, but the reliance on ferret/acts_as_ferret for search has made it impossible to do until now, as native C extensions don’t work with jruby.

The test machine is an Intel Core2 Quad @ 2.4Ghz with 8GB memory and SATA2 Raid5 disks running ArchLinux x86_64 and a 2.6.27 linux kernel. The benchmark consists of 23 different web pages from ClockingIT, requested 100 times each, using real data from my own hosted instance.

MRI 1.8.7 p72 / mysql / mongrel

Initial run: 6m46.396s
 Second run: 6m43.450s

jruby 1.1.5 –server / jdbcmysql / mongrel

Initial run: 6m8.400s
 Second run: 5m20.322s

jruby 1.1.6RC1 –server / jdbcmysql / mongrel

Initial run: 5m50.992s
 Second run: 4m59.823s

MRI 1.8.7 p72 / postgresql / mongrel

Initial run: 7m21.408s
 Second run: 7m17.608s

jruby 1.1.5 –server / jdbcpostgresql / mongrel

Initial run: 6m37.021s
 Second run: 5m55.811s

The PostgreSQL is mostly just there for comparison, and is not nearly as tweaked or optimized as the MySQL version, but it contains the same data.


12 Responses to “ClockingIT – JRuby 1.1.5/1.1.6RC1 vs MRI Benchmark”

  1. Christian Seiler Says:

    Which JVM?

  2. luisbebop Says:

    Hi Erlend. Nice post …

    I did some benchmarks with jruby 1.1.5 too, and even on Windows it is much more faster than MRI.

    I wonder Jruby will be ‘the solution’ to deployment rails application with the same configuration on multiple OS.

    I can deploy the same rails application in jruby, using the same webserver and jbdc drivers on Windows, Linux and Unix. The performance is the same, and I don’t need worry about extra configurations like database drivers.

  3. Chad Johnson Says:

    Are you sure two runs under Jruby is enough to warm up with JVM? I tend to, at least, do a `ab -n 15 ` to warm up a JRuby on Rails app.

    -Chad J

  4. @Christian Seiler:

    java version “1.6.0_11”
    Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
    Java HotSpot(TM) 64-Bit Server VM (build 11.0-b16, mixed mode)

  5. @Chad Johnson:

    As the first run consists of 2300 (23 pages x 100 requests) I’m pretty sure it’s warmed up. Doing more runs didn’t improve the time any either.

  6. @luisbebop:

    My main problems with running ClockingIT on different platforms so far has been Ferret and RMagick. Replacing them with versions that’s either pure Ruby or Java should make it possible to run on more platforms than today.

  7. dmpk2k Says:

    Can you make any comparisons between memory consumption?

    The limiting factor I usually encounter for Rails apps — ignoring the DB — isn’t the CPU but the memory. One of the problems with mongrels is there’s almost no sharing of memory pages, something JRuby might be able to take advantage of.

    The JVM probably has a larger initial footprint, but is there a point where more mongrels uses more memory than the same number of threads in the JVM?

  8. At the moment, it seems to be using more memory than a plain mongrel/thin cluster, but once Rails 2.2 kicks into gear and all gems you use are threadsafe, you should see huge memory savings as you’d only need one ruby instance + instance/local variables.

    I’ve only done simple testing with the Glassfish gem, and I have no idea if it attempts to share anything between the different Ruby instances that gets started.

    I do see better GC though, as with jruby I don’t see memory slowly increasing all the time once it’s peaked.

  9. Luca Erzegovesi Says:

    Hi Erlend, thanks for the huge value you are giving to all of us in ClockingIT.
    Are you developing a separate branch for the JRuby-Sphynx version? Do you plan to make the source available?

  10. It’s currently in a private branch, as I’ve yet to solve a couple of things (drop ImageMagic for example), but once I get everything ironed out and running on my own server it’ll be merged into master.

    — Erlend

  11. Luca Erzegovesi Says:

    Great! I have a positive experience with the ImageVoodoo gem as a substitute for ImageScience (I used it trying to run the CommunityEngine plugin in JRuby). I cannot say if it can suit your setting.

  12. Roch Says:

    It’s a pity that this blogs in in stand-by mode at this moment … Clokingit is good and nice and can be much better yet. Hey, come on, we are listening to you.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: