Vps – Running Ruby on Rails App on Apache + Passenger == to much memory

phusion-passengerredminerubyruby-on-railsvps

I'm running redmine (a RoR app) on my server using passenger / Apache 2.2. Passenger and ruby are using way too much memory.

Is there a more memory effective way to run redmine/ruby?

I only need to support a half dozen redmine users. I want to continue to use Apache, but I'm open to all suggestions that aren't "use nginx/lighttpd" instead.

(The following data is from a 512MB VPS, so Ruby is using more than 128MB just for redmine)

user ....... %mem   ....... process
-----------------------------------
www-data ... 13.6   0:00.65 ruby1.8
www-data ... 12.2   0:04.86 ruby1.8

www-data ...  9.4   0:04.15 apache2
www-data ...  9.0   0:13.94 apache2
www-data ...  3.2   0:00.27 apache2

root     ...  2.5   0:00.23 apache2 
root     ...  1.9   0:01.19 ruby1.8 

So, what's better for me than Passenger?

Thanks for your thoughts!!

Best Answer

You can configure how many Rails processes Apache/passenger spawns. For your size (3 concurrent requests) you should be fine with 2 rails processes:

Set these in your apache config:

PassengerMaxPoolSize 2
PassengerMaxInstancesPerApp 2

The MaxPoolSize determines how many instances can be started maximally, the MaxInstancesPerApp determines how many instances each web-app can have.

You might want to play with:

PassengerPoolIdleTime 

to specify how many seconds an instance must be idle before it is unloaded. Default is 300 seconds.

I run pretty high traffic web application with 3 instances without any problems.

Oh and - the Ruby Enterprise Edition helps too.

Related Topic