Alexey Verkhovsky wrote:
Hi, all,

I've been doing some quick and dirty shootouts running the Petstore
app from TW-commons RubyForge project.

The purpose of this exercise was not to draw any conclusions, but to
get a gut feel for the various factors that have significant impact on
performance of a Rails application running under JRuby.

Test procedure, in a nutshell was just repeatedly hitting a particular
page and measuring response rate. More details below.

I see a huge difference in favor of MRI so far. I am also a bit
surprised that AR-JDBC is slower than a pure-Ruby MySQL driver from
Rails.

A couple things to consider...

1. File IO is still rather slow in JRuby, and petstore is configured for normal file-based sessions. Switching to memory-based sessions would help quite a bit. Of course it would help MRI too, but it should help us more. 2. ab doesn't maintain sessions between requests, so you're spinning up a new session for each request. That combined with the slow file IO is probably a big part of our slowness. Try using httperf instead.
3. Again, slow file IO means turning off logging helps too.
4. User Java 6 server VM for  best results
5. Turn off ObjectSpace

Here's my unscientific numbers with petstore, httperf, and the changes above:

All on JRuby trunk, on my MacBook Pro 2.16ghz, one core disabled

[requesting /]
java 6 flat, webrick, rails mysql driver: 23.6 req/s (42.5 ms/req)
java 6 server, -O, webrick, rails mysql driver: 23.9 req/s (41.8 ms/req)

The fact that these numbers are so similar with such a drastic change in runtime parameters makes me think there's a non-CPU bottleneck somewhere, like IO. Here's mongrel numbers:

java 6 server, -O, mongrel, rails mysql driver: 88.9 req/s (11.3 ms/req)

I don't have current AR-JDBC handy, so I'll leave it to others to do a full retest. Here's Ruby numbers on my machine:

MRI, webrick, rails mysql driver: 39.7 req/s (25.2 ms/req)
MRI, mongrel, rails mysql driver: 171.5 req/s (5.8 ms/req)

Here's my httperf line:

httperf --wsess 1,1000,0 --server localhost --port 3000 --rate=0

So, with a few tweaks JRuby's something less than twice as slow for this test. Here's a page with data on it, presumably coming from the database:

java 6 server, -O, mongrel: 32.3 req/s (30.9 ms/req)
MRI, mongrel: 76.5 req/s (13.1 ms/req)

Still about 50%. httperf line:

httperf --wsess 1,1000,0 --server localhost --uri /shop/viewCategory.shtml?category=fish --port 3000 --rate=0

Running these tests with the app deployed as a WAR would be interesting to see too. Still, we obviously have more work to do to get mongrel/webrick execution up to par. As with most things, I'd guess it comes down to two things:

- IO performance
- regexp performance (used for request processing)

If others want to duplicate these results and try a few other tweaks, it would be nice to see.

- Charlie

---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to