Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reduce Mongrel Rails Memory Footprint & Increase performance?

My rails sites run Mongrel, I am having a problem with the amount of memory being used. My ruby-bin processes are using up about 66 MB of resident memory. How can I reduce the amount of memory used by rails?

It is not very economical to have many rails servers running on a single machine if they are eating memory at this rate. My php5 fcgi processes sit at between 15-25 MB.

I'm fairly unfamiliar with RoR, would using JRuby help? Any comments helpful in reducing memory footprint and increasing performance are more than welcome.

like image 538
Kekoa Avatar asked May 13 '09 19:05

Kekoa


3 Answers

You might look at Phusion Passenger and Ruby Enterprise Edition, which is the de facto standard setup for Rails apps these days. One of its aims is cutting memory use. It's also simpler than having a bunch of Mongrels.

like image 67
Chuck Avatar answered Oct 21 '22 07:10

Chuck


If you are not tied to apache for something else, i would also try nginx with Phusion Passenger. If you're concerned about memory usage, you should see a smaller footprint from nginx than apache, and the lastest version of Passenger will download, compile and install nginx for you with minimal headaches.

like image 38
PJ Davis Avatar answered Oct 21 '22 08:10

PJ Davis


You can also replace your mongrel process with Thin which is more efficient and has recently been patched in its Garbage Collection (thru eventmachine), to make it even better.

We use thin cluster behind nginx frontends with fine results.

like image 23
Oinak Avatar answered Oct 21 '22 09:10

Oinak