[Mongrel] Spawn mongrel on demand
Zed A. Shaw
zedshaw at zedshaw.com
Sat Dec 23 23:48:29 EST 2006
On Sat, 23 Dec 2006 20:30:03 +0100
François SIMOND <curio at free.fr> wrote:
> Hello Zed !
> Do you knows or plan a way to spawn mongrel processes on demand ?
There's a yes and no answer to your question. The "no" is that on demand spawning isn't a good way to plan your systems. Leaving system usage levels and resource allocation to a program only works for simple stuff. The second you get dugg or slashdotted and your fancy on-demand-spawner goes insane you'll understand why.
Typically though this is a problem that geeks *love* to try to solve. Every one of them has burned to the ground trying to do it though. Talk to anyone who's been through Apache on-demand tuning and the deadly oomkiller to find out how nasty this strategy is.
Instead, it's better to calculate the resources you have and the processes you'll need to meet your processing demands. Then, monitoring your systems to make sure they're operating within your planned limits helps to identify when this isn't working anymore. At that point your replan and roll out more hardware or some other redesign.
I'm sure though all the overly smart people in the room will go insane trying to solve this, so before you do read this: http://www.fudco.com/habitat/archives/000056.html
> I'm studying options to build an affordable but solid shared hosting
> You wrote something very promising in your "NEXT STEPS",
> A combination of the '"mostly C version' and the mongrel_cluster
> replacement would be an elegant method to save much RAM on servers
> (until Rails is thread-safe).
So this is the "yes" part of my answer. While I think on-demand spawning is retarded and hasn't worked in practice for any serious activity, there does need to be a much better process management strategy for Mongrel.
Nothing's defined yet, but the goal is to make managing process *manually* for mongrel very easy. It won't do on-demand scaling, or try to be smart, but instead just make it easy to flexibly control what processes are running and how many. In your situation of a shared hosting provider, I think you'd be able to setup an interface that allows your customers to pay for a temporary boost and then tell their mongrel cluster to boost up by that amount for that time.
> FastCGI implementations for Apache are good at this.
> Similar features (min-max processes, idle time before stopping a
> process, zombie check) for mongrel would be enjoyable :)
> .. just like inetd many years ago ;)
Oh man, do people really not remember their history? This attempt to manage fcgi and doing it poorly is the reason people end up writing their own monitoring software or using something like monit or runit. This just doesn't work. The idea is attractive, but in practice the tools available to monitor and control processes just suck.
So, hopefully a middle ground of simple flexible manual process control will be a better solution.
Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu
http://www.awprofessional.com/title/0321483502 -- The Mongrel Book
http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help.
More information about the Mongrel-users