Monday, November 17, 2008

Mac(OSX) Jruby and Rails 2.2 -- Part 2

Running webrick isn't doing what we want... How about Tomcat? Or maybe Glassfish? Well I have heard that glassfish is VERY EASY, lets checkit out...

Step 1:
~$ sudo jruby -S gem install glassfish
Successfully installed glassfish-0.9.0-universal-java
1 gem installed
Installing ri documentation for glassfish-0.9.0-universal-java...
Installing RDoc documentation for glassfish-0.9.0-universal-java...

DONE... no I'm serious... THAT WAS IT!!!

Lets start the server:

~$ jruby -S glassfish_rails myapp
Nov 17, 2008 7:21:23 PM com.sun.enterprise.glassfish.bootstrap.ASMain main
INFO: Launching GlassFish on Apache Felix OSGi platform
Nov 17, 2008 7:21:23 PM com.sun.enterprise.glassfish.bootstrap.ASMainOSGi findDerbyClient
INFO: Cannot find javadb client jar file, jdbc driver not available
...

Now I can access the rails app at http://localhost:3000/

NICE!!

Here is some more information about the glassfish gem:

-c, --contextroot PATH: change the context root (default: '/')
-p, --port PORT: change server port (default: 3000)
-e, --environment ENV: change rails environment (default: development)
-n --runtimes NUMBER: Number of JRuby runtimes to crete initially
--runtimes-min NUMBER: Minimum JRuby runtimes to crete
--runtimes-max NUMBER: Maximum number of JRuby runtimes to crete
APPLICATION_PATH (optional): Path to the application to be run (default:
current).


This is almost too easy for a development environment...

THIS IS NOT A BENCHMARK BUT even so here is the info...

My laptop with a test app I have and seed data installed thin 1.0 and Glassfish...

With threading:
============
Requests per second: Thin 10 [#/sec]
Requests per second: Glassfish 14 [#/sec]

Without threading:
==============
Requests per second: Thin 3 [#/sec]
Requests per second: Glassfish 2.6 [#/sec]

:) Not what I was hoping for ...

2 comments:

rasputnik said...

I'd expect Glassfish to be much better at high concurrency , you might want to try that out (the '-c' option to ab, if that's what you're using).

Freddy Andersen said...

Yes I would only imagine that Glassfish is going to kick butt when the concurrency goes higher... The testing I did was just a lets see what happens testing. I'm going to do more testing in the future to see how this setup will hold-up in a more production like environment.

This setup would be more for a development setup than production...