Ruby to JRuby Migration - Possible pitfalls

I have an existing ruby on rails (2.3.5) web application working on my
company’s intranet (around total 5000 users, and 50 concurrent users)
deployed on AIX box. Mongrel server is being used to serve requests.

Application is not that complex. Normal pages require 3-4 seconds of
database operations and 2-3 seconds for view rendering.

Now, we have requirement to release AIX box, and move to system having
websphere 7 installed. By policy, we can’t install two servers on same
machine. So we will have to deploy our app on Websphere 7 (which already
has around 10 java applications hosted).

We have converted our rails app to WAR using warbler and able to deploy
it to Websphere 7. Following are our concerns regarding its performance
and scalability.

  1. First, request to serve web page takes too much time. I guess thats
    because of JVM loading. Can we decrease this time?

  2. We have enabled threadsafe mode by enabling this line in
    production.rb.
    config.threadsafe!
    Is this enough to serve the purpose of handling concurrent web requests.
    How many concurrent requests would it handle.

  3. If we have config.threadsafe! enabled, will there be any effect of
    changing these lines in warble.rb

config.webxml.jruby.min.runtimes = 2

config.webxml.jruby.max.runtimes = 4

  1. Initial heap size and maximum heap size is set to 256 and 1792. And
    this websphere instance is also hosting around 10 other web
    applications. Would this be enough for our jruby application.
    Unfortunately, we are not allowed to change this value.

  2. What about concurrent web request handling? With these settings, is
    there any benchmark/stats of how many concurrent requests would be easy
    to handle by application.

Can anyone please guide for better production deployment
options/settings or other options to increase scalability.

Any ideas/suggestions?

Muhammad F. wrote in post #1074891:

  1. We have enabled threadsafe mode by enabling this line in
    production.rb.
    config.threadsafe!
    Is this enough to serve the purpose of handling concurrent web requests.
    How many concurrent requests would it handle.

Enabling this with jruby.min and max runtimes set to 1 enables making
best use of the multi-cores of your server with real-threading (just
ensure your code is thread-safe). For 50 concurrent users, it should
work anyways.

  1. If we have config.threadsafe! enabled, will there be any effect of
    changing these lines in warble.rb

config.webxml.jruby.min.runtimes = 2

config.webxml.jruby.max.runtimes = 4

With config.threadsafe! enables, suggest to use:

config.webxml.jruby.min.runtimes = 1
config.webxml.jruby.max.runtimes = 1

  1. What about concurrent web request handling? With these settings, is
    there any benchmark/stats of how many concurrent requests would be easy
    to handle by application.

Refer my update at Poor performance with JRuby on Rails - JRuby - Ruby-Forum &
Jruby in production - JRuby - Ruby-Forum for my suggestions and the kind
of throughput I could achieve with specific h/w.

On Thu, Sep 6, 2012 at 8:22 AM, Muhammad F. [email protected]
wrote:

Can anyone please guide for better production deployment
options/settings or other options to increase scalability.

Any ideas/suggestions?

Deploy your app to a virtual machine instance that best replicates your
intended target platform.

Configure the system so that it mimics the constraints of your
operations
team.

Then profile it independently to get a feel for how it will handle real
world use. You could simulate real world use by using the rails log from
your old install to prepare actual data.

How does the memory & cpu profile of your current app compare under
load?