GlassFish Server 3.0.1 provides a JRuby runtime pool to enable the servicing of multiple concurrent requests. It should be noted, however, that 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.
See Table 1–1 for descriptions of the JRuby runtime pool options.
The following are some important points to remember when configuring the JRuby runtime pool:
To allow consistent and fast runtime access for the requesting applications, the dynamic runtime pool maintains itself with the minimum number of runtimes possible. The pool may take an initial runtime value, but that value is not used after pool creation.
The JRuby runtime pool values can be set either at the container level or at deploy time:
To set the runtime pool values at the container level, use the asadmin configure-jruby-container subcommand, as described in Configuring the JRuby Container.
To set the runtime pool values at deploy time, use the asadmin deploy subcommand, as described in Configuring JRuby Deployment Options.
Runtime pool properties can be set simultaneously at both the container level and at deploy time. If both settings are used, the deploy runtime settings take precedence over the container runtime settings.