The Sun white paper "First Steps to Develop and Deploy Ruby on Rails Applications with GlassFish" (login or registration required) explains how JRuby brings the power of the Java libraries to Rails applications while GlassFish brings the power, scalability, and ease of use of a mature Java EE application server to these applications.
Ruby on Rails itself improves developer productivity by speeding up development of database-backed web applications. Using JRuby on GlassFish, firms can continue with their existing Java EE investments and realize the benefits of Rails. The white paper describes the fastest way to get to developing and deploying Ruby on Rails applications on GlassFish using JRuby. It lists the steps one needs to get started through GUI, command line and NetBeans IDE with JRuby applications on GlassFish.
Ruby on Rails is based on the Ruby programming language. For firms already invested in Java and/or Java EE—this means another language framework to integrate into their environments - thereby raising costs.
JRuby is a 100% Java-based implementation of Ruby. JRuby offers the advantage of providing access to the entire Java library, in addition to the ease offered by Ruby. GlassFish is capable of running JRuby and Ruby-based applications. GlassFish thus offers the advantage of running multiple types of containers (Java EE and Ruby, amongst others) in one environment. GlassFish brings a scalable, high-performance Java EE environment that can help to lever and scale Ruby applications.
Instead of requiring multiple instances as would be necessary in the traditional deployment model for deploying several Rails applications, a single GlassFish application server instance can deploy multiple applications in a running instance, the paper notes.
In addition, each application is deployed in a separate context root with its own set of resources, completely isolating each application from others. Unlike Rails, GlassFish does not require a server restart on application redeployment. These advantages can translate to fewer application resources, hardware resources and ease of management for a production system.
The white paper points out that Rails versions 2.1.x and lower are single threaded, which means each concurrent request requires a corresponding JRuby runtime. GlassFish can be configured to have sufficient JRuby runtimes available to process a given number of concurrent requests. GlassFish maintains JRuby runtimes in a pool. Whenever GlassFish receives a request, it uses a JRuby runtime from the pool to process the request. At the end of request processing, the JRuby runtime returns to the pool and is available for the next request. Thus, GlassFish makes it easier to handle concurrent requests. Applications based on Edge Rails do not require the pool configuration, since Edge Rails is multi-threaded. Only one JRuby+Rails 2.2.x runtime would suffice for concurrent requests.
The paper deals with such aspects of developing and deploying Ruby on Rails applications on GlassFish as:
- Installation and Configuration
- Configuring a Ruby on Rails Application
- Develop a Rails Application with NetBeans 6.5
- Develop and Deploy a Rails Application on Command Line
- GlassFish Gem
Code samples and screen shots are included to illustrate the process.
More Information
GlassFish Community
GlassFish Scripting
JRuby on the GlassFish Application Server
GlassFish Gem
Benefits of Sun GlassFish Enterprise Service Bus 2.1
JRuby on GlassFish Deployments
[...read more...]
Other articles in the Developer section of Volume 139, Issue 1:
An Introduction to Developing and Deploying Ruby on Rails Applications with GlassFish
(this article)
See all archived articles in the Developer section.
|
|
Top 10 Most Popular Articles in Current Issue (Vol 168, Issue 1)
|
|
|
|
|