Next we wanted to understand how many Passenger Rails processes we could allow to run per server. Ngin is a very memory intensive Rails app, as outlined in Upgrading to Ruby 1.9.3: An Ngin Platform Overview. Ngin was memory bound with REE. Running on EC2 High CPU Extra-Large instances with 7 GB of RAM and 8 cores we were only able to run Passenger with 9 Rails processes as each Rails process utilized 400-500 MB of RAM. With Ruby 1.9.3 the memory footprint was reduced by 45% down to 250-275 MB of RAM!

We knew we could allow up to 18 Rails processes from a memory perspective. Ngin spends half of each request waiting on the database or other web services. With REE having 9 single-threaded Rails processes running on an 8 core machine we were only utilizing 50% of the cpu! With the reduced memory footprint of 1.9.3 we were hoping we could run with 16 Rails processes, 2 per core, before hitting a CPU bottleneck.