How much memory should the rails stack be consuming

apache-2.2memorymemory usagephusion-passenger

I am running my own webserver on a 384MB VPS from Slicehost to serve two Ruby on Rails applications on separate Virtual Hosts. I am running Phusion Passenger with Apache2. The following is the contents of my Passenger.conf

<IfModule passenger_module>

PassengerRoot /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.11
PassengerLogLevel 0
PassengerRuby /usr/local/bin/ruby
PassengerUserSwitching on
PassengerDefaultUser nobody
PassengerMaxPoolSize 3
PassengerMaxInstancesPerApp 2 
PassengerPoolIdleTime 300

# Ruby on Rails Options

RailsAutoDetect on
RailsSpawnMethod smart

NameVirtualHost *:80
</IfModule>

If i do a 'top' on my server I have 314MB used on average, this seems like too much? Am I mistaken and if not what possible steps can I take to reduce the Memory usage?

Thanks!

Best Answer

It all depends on the applications you are trying to host. The more models / controllers an application has the bigger the application will be. To get a better feel for how much the rails application itself is using try issuing the command.

passenger-memory-stats

My medium-sized application at this moment is using:

### Total private dirty RSS: 68.93 MB

According to passenger. If you have a bunch of sites running on the same passenger instance it could look more like:

### Total private dirty RSS: 1489.46 MB

Also consider that if you run a stock mysql-server the settings are not really optimized for VPS (and thus low memory) usage.