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.