Sun recently released a new version of its open-source Java application server. GlassFish V3 Prelude targets the Web tier, and is based on a modular architecture that ties optional plug-in modules into a small kernel via OSGi.

In this interview with Artima, John Clingan, Sun's GlassFish Group Product Manager, and product management director Paul Hinz, describe the latest GlassFish features most relevant to developers, including rapid deployment, and working with Rails applications:

Paul Hinz: The main concept for GlassFish V3 was to make the application server modular. Customers wanted to have a Web server that could be light-weight for the Web tier, but could also do everything you'd want to do with a big, mission-critical container.

V3 is built around a kernel, which is based on OSGi, and plug-ins, or "Lego blocks," around that kernel. Anything you want to do, from light weight things to more heavy-weight applications, you just plug in a module that you need for some task, and you're ready to go.

The full GlassFish V3 release was always scheduled for Spring, 2009, in part to align with the release of Java EE 6. But as we finished working on the modular architecture, came up with the kernel, and started to create the first modules, the GlassFish community started to say, "We could use this now, we don't have to wait for the full V3." That's how we made the decision to release GlassFish V3 Prelude—it's before the full V3, but it's the same kernel, the same architecture, the same initial modules. Although we call it "Prelude," it really is ready for production use. In fact, we can sell you a full support contract for V3 Prelude already.

V3 Prelude is targeted at the Web tier, and provides the light-weight features that people using Tomcat would be familiar with. It brings to the Web tier not just Java support, but also scripting and dynamic language support. You can run Java, and also Groovy, Groovy on Grails, and JRuby on Rails, without sacrificing your performance.

Frank Sommers: Why would a developer currently using Tomcat for development, or deployment, want to switch to GlassFish V3 Prelude?

John Clingan: Although V3 Prelude does not include an EJB container, MDBs [message-driven beans], a message queue, or other features of a full-fledged Java EE server, it supports JSP, JSTL, JSF, Servlet 2.5. It provides a lot of what Tomcat provides, but more. The V3 Prelude download itself includes JTA, JavaDB, and has full Comet support to push updates out to rich clients.

If you're looking for deployment ease, especially in a production environment, V3 Prelude has an rich-client administrator console that greatly simplifies application management. You can manage the life-cycle of your applications through that administration console, deploy, start, stop, un-deploy applications, configure your HTTP listeners, connection pools, or enable and disable monitoring.

You also get access to what we call the Update Center via the administration console. The update center makes it very easy for you to extend V3 Prelude with many additional features. For example, through the Update Center you can enable V3 Prelude with the fully-supported, final version of JAX-RS 1.0, as well as early-access versions of EJB 3.1 and JSF 2.0. You can also extend V3 Prelude with a Web services stack, Metro, that provides .NET Web services interoperability. jMaki is up there, too, as are the Grails and Rails containers.

In addition, we provide in V3 Prelude what we call a rapid deployment technology. In the past, you could build your application in your developer tool, deploy it, and go over to your browser and view it. With Prelude V3, you can now go back to your IDE, make an edit, click save, and immediately go back to your browser and hit refresh. Not only do you get [to see] the changes, but also the same session and session state you had before.

That feature very much improves developer productivity, especially in combination with the light-weight, modular framework: You can just keep the thing running, there is no reason to restart. And because it's built on OSGi, you can even add modules dynamically to enhance the functionality without restarting the application server. OSGi allows us to dynamically enhance the capabilities of the runtime. That can be very important when deploying in a production environment.

I should mention that developers using dynamic languages and frameworks also benefit from GlassFish V3 Prelude's modularity. The native JRuby container, the Groovy container, and the Java container, all can run side-by-side at the same time. That way, you can have just one runtime for various applications.

Frank Sommers: What are the new features in V3 Prelude for Ruby on Rails development and deployment?

John Clingan: Traditionally, developers wanting to run a Ruby on Rails app in a [Java] application server had to deploy their Rails app as WAR file, using Warbler or a similar technology. You can still do that in V3 Prelude, but V3 Prelude also includes native JRuby support.

V3 Prelude runs the JRuby runtime as part of the modular architecture: it's just another module that plugs right in. For Ruby developers, that feels a lot more natural, because you don't have to go through the typical deployment step: you just copy the code into the right directory, and refresh the Web browser.

From a runtime perspective, we have a pool of JRuby runtimes, kind of like a JDBC connection pool. As the demand [on the application] increases, [GlassFish] will instantiate more JRuby runtimes within V3 Prelude. As demand decreases, it will free up—garbage collect—some of those runtimes. The idea is that you can set a low and a high watermark, and V3 Prelude will be smart about resource utilization.

That's different from the traditional Rails deployment using something like Mongrel: You need to pre-allocate a fixed amount of Mongrel processes to a Rails application, whereas GlassFish manages resources more intelligently. Although performance optimization was not a goal of the V3 Prelude release, our initial tests show Rails application performance to be very good. We are faster than Mongrel for the simple cases, and are at least on par with Mongrel in the more complex cases.

Frank Sommers: Could you give us some insight into the rapid deployment feature in V3 Prelude? How does it compare to technologies, such asJavaRebel?

John Clingan: They're different technologies. [JavaRebel] basically uses class loader swapping, where they would swap in a new version of a class, and they do that at the classloader level. What GlassFish V3 does is that since you already have the serialized session in memory, we hold onto that while we re-deploy the application. Then we store that serialized session back into the container. Instead of reloading just one class, it's almost like a full application re-deploy, plus we restore the session state. The advantage is that we handle more of the edge cases in doing rapid development. So these are two different approaches.

Frank Sommers: What lead you to choose OSGi? There several alternative Java module technologies currently under development, some in the JCP.

John Clingan: We chose OSGi because that's what customer and user demand was for. We started down one route, and then the community said, "But we want OSGi." We got feedback from customers, and feedback from the community, lots of feedback at JavaOne, and we made the decision to move to OSGi based on what everybody wanted. We're a customer-driven project.

One advantage of OSGi is that it's a familiar technology to a lot of developers. Someone can write an OSGi module, install it into GlassFish, and then we offer extension points for the command line and for the Web administration GUIs. So you can write an OSGI module, and also allow your users to configure that through the administrative console or the command line.

Frank Sommers: You mentioned that Sun offers support and services for GlassFish V3 Prelude. How does that support work, especially if someone already has a support contract for GlassFish V2?

John Clingan: We wanted to keep the support offering very simple: If you buy a GlassFish annual subscription, you can deploy either V2 or V3. Our subscriptions start at bundles of four sockets, and you can deploy any combination of GlassFish versions.