Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Whither the GlassFish Gem? Alternatives for Deploying JRuby Web Applications

Whither the GlassFish Gem? Alternatives for Deploying JRuby Web Applications

This item in japanese

When Oracle released its GlassFish roadmap in March, one notable absence was any mention of the GlassFish gem. This gem-based server for Rails, Merb, and Sinatra applications has become a popular deployment option for the JRuby platform (e.g., it is part of BitNami's JRuby stack) and has been widely recommended to the JRuby community. The server is lightweight—the 4.3MB gem consists only of the GlassFish v3 kernel, Grizzly, and some utilities—but is a production-quality application server that has been known to host Sinatra applications handling loads of thousands of requests per second. The gem allows Rails users running in multithreaded mode to take advantage of the JVM by running multiple threads in a single server instance.

At the beginning of March it became known through the jruby-user mailing list that the GlassFish gem team had not made the transition from Sun to Oracle and that the project was probably abandoned. When asked to comment, Oracle said:

We will continue to encourage the community to continue working on the GlassFish gem and we will continue to offer assistance to those that want to continue to evolve the gem.

Engine Yard has not indicated whether the GlassFish gem will be included in its commercial JRuby support. The JRuby Summer of Code wiki proposed developing "a new fast tiny server based on the GlassFish gem, or else taking over the GF gem and spinning it off into its own project."

In mid-April Vivek Pandey, GlassFish gem project owner and lead developer, notified the list that he planned to invest some time in documentation and possibly start releasing new versions. However, Oracle is not supporting this work and the project is only a sideline for him. "It would be great to have people help us by contributing to it."

What kinds of contributions is he looking for? "Bug fixing, adding features (if any) and releases. Also, docs and evangelizing. The codebase is not big."

Subsequent discussion on the list has seen some interest in moving the project forward.

Part of the GlassFish gem's popularity is its ease-of-use. When asked why BitNami offers both Tomcat and the GlassFish gem as part of its JRuby stack, BitNami's Daniel Liszka replied:

People still seem to be more familiar with Tomcat. We want to give them a choice. Apart from that it is more difficult to deploy Ruby on Rails on Tomcat than on GlassFish, and we wanted to simplify the process as well for those users that need to use Tomcat for any other reason.

Deployment to Tomcat, as well as to other J2EE application servers such as GlassFish, JBoss, or WebSphere, can be accomplished using Warbler, a gem that will make a WAR file out of a Rails, Merb, or Rack-based application. Warbler released version 1.0 in early April, adding support for Rails 3. "I'm pleased to have Rails 3 working well with Warbler-created WARs as I think Rails 3 is positioned to be a standout framework that Java developers should be considering to build web applications," said Nick Sieger of Engine Yard.

Warbler is of course not a development tool like the other servers but a deployment tool. [...] WAR deployments are much more common in existing java shops.

Warbler 1.0 also now supports packaging bundled gems with Bundler.

Other servers also exist in the JRuby space. Torquebox, for example, wraps JBoss. According to JBoss Fellow Bob McWhirter,

Torquebox aims to take the existing enterprise-grade JBoss Java app-server and adapt its full capabilities to the world of Ruby, using JRuby.

This includes facilities such as exposing the Quartz job-scheduler and the HornetQ message broker in a manner friendly to rubyists. The goal is to allow the full application, not just the web portion, to be a deployable and manageable unit.

Torquebox is significantly heavier than the GlassFish gem: Its distribution is not gem-based and weighs in at almost 300MB (this includes a complete JRuby installation in addition to the server). A gem of less than 10MB is "on my roadmap for web-only capabilities. Of course, you won't get JMS integration and such with that."

David Calavera's Trinidad is a gem-based Rack application server on top of Apache Tomcat. To run it, you "just need to point to the root directory of a Rack based application and run a simple command, 'jruby -S trinidad'," Calavera says.

One of its main advantages is that it's really lightweight. While other servers are built as monolithic libraries, Trinidad is distributed; the core is less than 15KB and the required libraries are 3MB more or less.
Trinidad is completely written in Ruby, and instead of grouping a bunch of features into the same package it allows releasing features as separate extensions.
Trinidad also allows running several applications in the same container.

A final alternative is Fabio Kung's jetty-rails, which will run Rails and Merb applications within a Jetty container. Though the project has not been updated since June 2009, Kung still envisions making improvements to it in the future.

Rate this Article