The default configuration for running JRuby on Rails using GoldSpike only allows 4 instances of the JRuby runtime. This means that if there are more than 4 simultaneous requests from clients, the web server will respond with a server overloaded error. The easiest way to see what’s going on is to take a look at the ‘createObjectPool’ method of RailsServlet.

With a dedicated production server with 1gig of memory, it is possible to allow a lot more JRuby runtimes, and hence allow for more simultaneous users. A little load testing on a fairly small app suggested that 20 instances of JRuby runtime would fit comfortably under the 1gig ceiling and not overload the processor.

An easy way to change the max number of runtimes is to edit ‘web.xml’ in a JRuby application’s WEB-INF directory. Parameter is set as follows:


It is also worth checking with the web server configuration to ensure that the web server allows more threads than the number of JRuby runtimes specified in ‘web.xml’.