Sun GlassFish Enterprise Server v3 Scripting Framework Guide

Enterprise Server v3 JRuby Container Configuration

The Sun GlassFish Enterprise Server v3 provides the following ways to configure the installed JRuby container.

Configuring JRuby Container Through Asadmin CLI

The asadmin CLI now provides options to configure the JRuby container. The command execution is reflected in changes to the JRuby container configuration section of the domain.xml file which makes them persistent.

The following JRuby container properties can be configured through the asdmin command.

configure-jruby-container [--help]
     [--jruby-home jruby-home]
     [--jruby-runtime jruby-runtime]
     [--jruby-runtime-min jruby-runtime-min]
     [--jruby-runtime-max jruby-runtime-max]

Use the following asadmin command syntax to configure these values:

asadmin configure-jruby-container --<property>=<value>

For example, the following command is used to set the JRuby home if JRuby instance is installed as standalone:

asadmin configure-jruby-container --jruby.home=/<jruby-install-location>

You can also change the deployment specific options to the JRuby application through the following command syntax:

asadmin deploy --property <name>=<value>[:<name>=<value>]

For example, the following command uses a JRuby instance to deploy your application which is different from the one configured with the Enterprise Server:

asadmin deploy --property jruby.home=/<latest-jruby-install> <application>

For a detailed description of these options, see configure-jruby-container(1).

The JRuby container runtime pool options are discussed in the next section.

Configuring JRuby Runtime Pool

The Sun GlassFish Enterprise Server v3 provides a JRuby runtime pool to allow servicing of multiple concurrent requests. However Rails is not currently thread-safe, and while JRuby is able to take advantage of Java's native threading, Rails cannot benefit from it. Each JRuby runtime runs a single instance of Rails, and requests are handed off to whichever instance happens to be available at the time of the request.

The JRuby properties in the above configuration are explained as follows:

The dynamic runtime pool maintains itself with the minimum number of runtimes possible, to allow consistent and fast runtime access for the requesting application. The pool may take a initial runtime value, but that value is not used after pool creation.

The JRuby runtime pool values can be set either at container level or at deploy time. To set the runtime pool values at container level, use the following asadmin command:

asadmin configure-jruby-container --jruby-runtime=2 --jruby-runtime-min=1 --jruby-runtime-max=3

Note that each of the above properties can be set separately at a time. To set the runtime pool values at deploy time use the following asadmin command:

asadmin deploy --property jruby-runtime=2:jruby-runtime-min=1:jruby-runtime-max=3

Each of the above properties also can be set at a time or at the same time. If both settings are used, deploy time settings take precedence over container runtime settings.

Configuring JRuby Container Through Administration Console

The JRuby container values can be set from Enterprise Server Administration Console. For details on Administration Console, see Administration Console in Sun GlassFish Enterprise Server v3 Administration Guide.

You can set the following container properties from the Administration Console:

Use the following steps to access JRuby Container from Administration Console.

ProcedureTo Configure JRuby Container from Administration Console

  1. Access the Enterprise Server Administration Console from web browser. For example:

  2. Login to the Administration Consoleif configured for secure login.

  3. Select Common Tasks->Configuration->JRuby Container on the left-hand tree panel.

  4. Change JRuby Container values from the details panel.