3 ms·
I run userscripts.org, a rails site which runs on a single serverbeach box. To keep memory usage low, I find recycling mongrel processes via monit can help a b
by anotherjesse 18y ago
I run userscripts.org, a rails site which runs on a single serverbeach box.
To keep memory usage low, I find recycling mongrel processes via monit can help a bunch.
Before monit, my mongrels would hit 2GB quickly, after monit with a rule to restart when they hit over 100MB, my memory usage is around 800MB for 15 mongrels. (I'm assuming you are using HAProxy or a similar balancer that can deal with changes of availability).
http://userscripts.org/articles/2-scaling-a-rails-site http://userscripts.org/articles/2-scaling-a-rails-site
Another useful tip is make sure your queries aren't doing stupid stuff. A long time ago I had integrated Beast (a rails forum project) into my site. Unfortunately it was loading EVERY topic on the forum index page, which was resulting in slowness as well as large jumps in memory usage. (The culprit was a .last method that caused all the records to load and then grab the last value)
So - I tend to agree with "don't worry" because you can "patch" over memory usage pretty easily.
My site is currently getting 17req/s on a single box - it is never what you think will be the issue that you have to fix.
- jgalvez 18y agoThat's the thing that making me nervous. When you have got to a point where you need to periodically restart your processes because they somehow uncontrollably start consuming more memory than they should, something must be failing badly. Where there's smoke, there's fire.