Monday, April 28, 2008

Some Rails perf numbers on JRuby 1.1.1

UPDATE: Next up will be the same benchmarks using Java 6 on ubuntu.

Just before JRuby 1.1.1 was released, I was surfing around and found this post which shows JRuby running basic Rails bench tests slower than MRI. I wondered what those numbers would look like now, so I got to testing.

I started by downloading the latest binary release of JRuby here.

I setup a Rails app following the theme mentioned by the blog post above, then ran the console benchmark 6 times with each runtime and list the lowest time below:
[sourcecode language='css']
jruby -J-server script/console production
>> Benchmark.measure {10000.times {Person.find :first}}.total
=> 10.352999925613403

ruby script/console production
>> Benchmark.measure {10000.times {Person.find :first}}.total
=> 4.98
[/sourcecode]

Now I wanted to see if the ActiveRecord-JDBC drivers would help the situation:
[sourcecode language='css']
jruby -S gem install activerecord-jdbcmysql-adapter
vi config/database.yml ("mysql" -> "jdbcmysql")

jruby -J-server script/console production
>> Benchmark.measure {10000.times {Person.find :first}}.total
=> 4.134999990463257
[/sourcecode]

console results


Sped things up quite a bit... Now for Mongrel:
[sourcecode language='css']
> mongrel_rails start -e production
Requests per second: 202.27 [#/sec] (mean)

jruby -S gem install mongrel
jruby -J-server -S mongrel_rails start -e production
Requests per second: 96.47 [#/sec] (mean)

# now with adapter: jdbcmysql about the same... got a bit faster after warm-up
Requests per second: 120.05 [#/sec] (mean)
[/sourcecode]

MRI's Mongrel beats JRuby version even after a little warm-up period. I also wanted to see what GlassFish would do :
[sourcecode language='css']
jruby -S gem install glassfish

jruby -S glassfish_rails start ../person_test/
Requests per second: 132.93 [#/sec] (mean)

# now with jdbcmysql adapter
jruby -S glassfish_rails start ../person_test/
Requests per second: 139.96 [#/sec] (mean)
[/sourcecode]

Just goofing around, I used an experimental setting to see what would happen. I repeated the benchmark for some time and you can then really start seeing the JVM 'harden' the execution path... I'm sure the tests above may have benefited in the same way had I let them run but here are the numbers of a glassfish_rails server with 2 Rails instances (probably ran the benchmark about 10-15 times?)
[sourcecode language='css']
jruby -J-server -J-Djruby.compile.fastest=true -S glassfish_rails start -n 2 ../person_test/
Requests per second: 211.64 [#/sec] (mean)
[/sourcecode]

I also wanted to see some numbers for Tomcat 6, a war'd Rails app using Warbler. The numbers were not at all what I was expecting... even though I know things out of the box are not tuned for this type of deployment. The best numbers I could get were:
[sourcecode language='css']
Requests per second: 67.68 [#/sec] (mean)
[/sourcecode]

Rails perf chart


So what does this tell me? JRuby is getting faster each release. There is more work to be done to make JRuby on Rails apps faster. GlassFish is a very easy way to deploy JRoR apps. And last, I am definitely doing something wrong with my war'd depoyment!

I could not find much else in the way of JRuby on Rails benchmarks... if you know of any, please link in comments!

P.S.
All these benchmarks were run on a MacBook 2GHz Core Duo with 1GB mem., Java 5, JRuby 1.1.1, Ruby 1.8.6, Ruby on Rails 2.0.2, MySQL 5.0.27.

Aloha Color Theme for NetBeans 6.1*

UPDATE: The Aloha theme is included in the Extra Ruby Themes module
for NetBeans.


Finally... (sorry for the wait) The Aloha Color Theme for NB 6.1 is available for download.

The original version for 6.0 (here) had issues coming over. If you have not updated yet, you will want to with this list of features.

Aloha Color Theme for NetBeans


Aloha Look


Ruby


xml


XML



C



Java



JavaScript



CSS


NetBeans Download the NBM here. NetBeans


After the download, open NetBeans and go to Tools > Plugins. In the Download tab, add the AlohaTheme.nbm and install. To use it, just select it from the Fonts & Colors profile "Aloha."



You will want to go change the "Diff" colors which are not included in the theme (not yet anyway). Color of Added Text: Black, Color of Changed Text: Dark Grey.

Monday, April 21, 2008

JRuby 1.1.1 to be released today!

2 short weeks after the JRuby team released version 1.1 we'll see the next release some time today.  Version 1.1.1 resolves 41 issues and focuses on stability, performance and compatibility according to Charles Nutter.

Issues still exist with JRuby on GCJ and possibly on IBM's JVM 5.  Anyone using these platforms is encouraged to submit bugs or possibly fixes.

The pace on this project is truly amazing...  I plan to write-up a few posts about a recent project I worked on which used JRuby and Rails to speed development, exciting times my friends!

Monday, February 4, 2008

Project PEA - test coverage with a magnifying glass

Matt Harrah recently wrote about his new toy: Project PEA. This thing is like test coverage reporting with a magnifying glass. Matt, Jeff Richley and I have had conversations in the past about the topic and the way test coverage reporting tools can give you a false sense of security.

Project Pea


The idea is to find the spots in your test coverage that may be 'accidental' having been buried beneath too many layers to be effective. (hence the name of the project.)

If you work in an environment with test coverage requirements, you may want to take a closer look at Project PEA.

Friday, January 25, 2008

Aloha Color Theme for NetBeans 6

UPDATE: The Aloha theme is included in the Extra Ruby Themes module
for NetBeans.


UPDATE: Go get the new version for NB 6.1 here.

UPDATE: I've started looking into updating the theme for NB 6.1 (due out in a few days) I'll create a new post and link to the download once it's complete. Thanks for your patience.

I've been giving NetBeans 6 a try lately and I'm enjoying it very much... but I really like the color themes available for TextMate. I'm not a big fan of the defaults and I wanted something different... so I started looking. The Ruby Dark Pastels theme by Jerrett Taylor comes with a plugin download, I found this theme called Fade to Grey by Brasten Sager and then I stumbled upon this color theme by Carmelyne Thompson. The theme Carmelyne created was what I was looking for with a few tweaks. And since I do work with a lot of different file types, I wanted to make sure most if not all the file types held the color theme. So after a few tweaks and writing something to help me create my NetBeans Module file... here are the results:

Aloha Color Theme for NetBeans


Aloha Look


Ruby


xml


XML



C



Java


NetBeans Go get NB 6.1 and use the theme on this page instead!!! NetBeans


After the download, open NetBeans and go to Tools > Plugins. In the Download tab, add the AlohaTheme.nbm and install. To use it, just select it from the Fonts & Colors profile "Aloha."


I can't get the CSS to stop painting the keywords neon blue and it can be a little hard on the eyes... if anyone knows how to fix this, please let me know.