FAQs relating to JRuby and GlassFish

  1. Why Ruby when there are many other languages ?
    • Ruby is getting popular due to Rails.
    • Ruby-on-Rails (ROR) is very popular among web developers.
    • JRuby is a pretty mature implementation of Ruby in Java, running on JVM and able to use existing Java libraries.
  2. Can the number of JRuby instances created by GlassFish be configured ?<br>
    Yes, it can be configured as defined here.<br>
  3. Can GlassFish support multiple Rails versions ?<br>
    Yes. Follow the Rails programming model to specify which Rails version your application is using.
  4. In the GlassFish case, will the threads supporting the Rails instances share the variables or is it standalone ?<br>
    Every request would happen inside its own Rails instance, and there would be no sharing during requests. The deployment model is largely the same as with mongrels, but without the mongrels.<br>
  5. During record migration the associated Active Records need to be refreshed. How is this done as part of the hot deployment cycle ?<br>
    A shim can be written that run the migrations upon deploy of the WAR file. There's a precedence for this sort of thing, with products like JIRA that do a database scan at startup to make sure you're running the correct version of the tables. It's not going to be for everybody, but if you have full control of your deployment it's a nice convenience.
  6. What advantages does JRuby-on-GlassFish offer to smaller enterprises ?<br>
    GlassFish offers several advantages to enterprises:
    • Allows RoR and Java EE applications to co-exist on the same container.
    • Simpler/Similar development/deployment model
    • Database connection pooling
    • Hot deployment of WAR (no need to restart the container)
    • All the advantages of Load Balancing, Clustering, High Availability are available for further scalability as well.
  7. What are the benchmark numbers on JRuby ?<br>
    Some pointers:

And around 1.1 there will be consolidated numbers for all the benchmarks. Performance has improved again since all these sets were published.

  1. When would 1.8.6 support be introduced in JRuby ?<br>
    There are plans to update stdlib in JRuby 1.1 - that's really all is meant by 1.8.5 support, since largely that's all that's changed.
  2. How is load balancing configured in GlassFish ?<br>
    A cluster of GlassFish instances can be load-balanced using any of the following approaches:
    • Sun LB plug-in on Sun Web Server, Apache and IIS
    • Apache (mod_jk)
    • F5
    • Sun Secure Application Switch

Read more about how to setup/configure load balancer with GlasFish v2.

  1. How does GlassFish deal with caching of pages ?<br>
    The file cache in Grizzly provides caching where static pages are served without talking to the Web server.
  2. What is the state of Rubinius support in JRuby ?<br>
    The state of Rubinius (and other Ruby implementations) is described at http://headius.blogspot.com/2007/11/top-five-questions-i-get-asked.html. Also read a more recent update here.<br>
    There are no further updates on Rubinius bytecode support since Rubinius bytecode seems to be still changing. We've also managed to improve normal interpreted performance, so we're happy enough that installing a new bytecode engine hasn't been a priority.<br>
    The JRuby team occasionally plays with getting Rubinius's implementations of various core classes to run in JRuby, and they usually work well but with about a 2x performance hit.
  3. Are there any benchmarks on the speed of static pages between GlassFish (Grizzly) and Apache httpd ?<br>
    Yes, the benchmarks are available here.
  4. How to build GlassFish V3 and JRuby GlassFish gem ?<br>
    • Pre-Requists
      • Subversion client
      • Maven 2.0.x
    • To build GlassFish V3

<pre>
svn checkout https://svn.java.net/svn/glassfish-scripting/trunk/rails/v3
cd v3
mvn clean install
</pre>

    • To build GlassFish gem
svn checkout https://svn.java.net/svn/glassfish-scripting/trunk/rails/v3/gem
   cd gem
   mvn clean install

The gem would be present under target/dependency/glassfish/pkg.