Hi all.
I¹ve been running a bunch of performance tests comparing JRails deployed
in
JBoss to Spring (a Java MVC framework), and the results I¹ve gotten
aren¹t
good for JRuby. I¹d really like to be able to start moving towards
Rails,
but I there are a few deal-breakers I¹d like to figure out. First, let
me
describe my environment:
Dev:
Mac OS X Leopard
Java 1.5.0_13
Prod:
Centos 5
JBoss 3.2.7 / Jetty 4.2.24
- 3G RAM and 256M PermGen space
- -server -Djruby.compilation.mode=FORCE
-Djruby.objectspace.enabled=false
-Djruby.thread.pooling=true - war configured to start 10 JRails runtimes
Java 1.5.0_14
JRuby/Rails:
JRuby 1.1.1
Rails 2.0.2
Warbler 0.9.5
My webapp is very simple. It¹s a three page drilldown that uses a
native
Java DB class (shared between the JRails and Spring implementations) to
call stored procs in an Oracle DB.
I¹m using Grinder to make repeated requests with increasing numbers of
threads, from 1 to 50 in increments of 5. At each thread count, I¹m
making
about 150 requests (50 to each type of page).
What I see from the client side is many responses returning in a
reasonable
amount of time (the average request time under heavy load is around
1-1.5
seconds, but many requests return in 100-200 milliseconds), but many
threads
seemingly blocking for a long time (the standard deviation on request
time
is as high as 30 seconds).
On the server side, Rails reports some requests being processed for as
long
as a few seconds (as many as 5 or 6), but never for as many as 30. The
JVM
is also garbage collecting like crazy from the moment JRuby starts. I
suspect that the long delays are a result of threads being blocked
waiting
for garbage collecting, but I¹m not positive. I eliminated the DB code
as a
potential cause by running the same suite of tests on a simple ³Hello
world²
app, and got approximately the same performance results (Spring shows
about
a 5-fold increase in throughput).
My assumption is that the constant overhead of garbage collection is the
bottleneck, but I¹m by no means convinced. I¹ve read that IBM and
ThoughtWorks have deployed JRails apps in similar environments, so my
results are confusing and frustrating.
Here are my questions:
- Is there a way to tame the garbage collection? I suspect that
objects
are being created and deleted with each request rather than being
reused. - Can Rails be fully compiled to Java? Can a Rails app? It seems like
that¹s a goal of jrubyc, but is it possible with the current version? - Am I missing some bit of configuration in the war deployment that
will
tell JRuby to be more conservative with object creation?
Sorry for the long email. Thanks for taking the time to read!
-Matt