117m 49m 3156 S 0 13.8 0:00.93 ruby # spawner 49M171m 89m 2240 S 0 24.7 0:00.61 ruby # instance 89mRailsSpawnMethod conservativethis results in [slower startup times and]
If you're worried about slow startup speed, you can set your rails processes to never expire[4].
4: If you use multiple processes per rails app, then set your spawner process to die quickly.
Though I haven't used it, theoretically the spawner process will be killed eventually--so set it to die quickly, to free up that expensive RAM[5].
You could do something like
ab -n10 -c10 http://yourhost
to ensure it fires up all the processes from the spawner, then the spawner is free to die quickly.
If you don't use REE, then don't use the spawner at all--little savings there RAM wise.
I have a suspicion that even with REE, you don't see much RAM savings, but having not used it, I can't say for certain.
4: use the MBARI patches to MRI.
Originally, one of my rails apps started at 89MB RSS then grew in total RAM usage by ~ 8MB per request, linearly. Odd? Yes. Fix: I recompiled ruby using the MBARI patches to 1.8.6/1.8.7. It now starts at 60MB RSS and stays there solid [1]. That's right--it stays solid at LESS than an unpatched ruby starts at. And with higher speeds [6].
Also avoid the ruby that comes bundled with ubuntu--though it uses the same amount of RAM as normal, it is compiled with pthreads enabled so it is slower.
Using 1.9 might also yield RAM savings like this. Haven't tried it though.
Savings: unknown since it appeared to growing forever (a lot though).
Overall Result:
Enjoy!
use nginx instead of apache--faster, much better RAM usage. Potential savings:
[4] http://www.modrails.com/documentation/Users%20guide%20Apache.html#PassengerPoolIdleTime
[5] http://www.modrails.com/documentation/Users%20guide%20Apache.html#_railsframeworkspawneridletime_lt_integer_gt
[6] http://www.nabble.com/-ruby-core:19846---Bug--744--memory-leak-in-callcc--to20447794.html#a21140287





and
.

