[Mongrel] Anyway to "dynamically" start/stop mongrel based on web traffic?

Philip Hallstrom mongrel at philip.pjkh.com
Wed Jan 10 18:34:48 EST 2007


> Philip Hallstrom wrote:
>> Then I could either kill off the mongrel later if no traffic was coming
>> in.
>>
>> Or perhaps mongrel itself could stay running, but unload (and free the
>> ram) of rails until a request came in, then load it back up for awhile
>> until traffic stopped and unload it...
>
> What you're talking about is inetd functionality for a rails process. If
> you're on a sane unix, you could probably make that happen. Take a look
> at /etc/inetd.conf, or your version thereof.

Kind of... my understanding of inetd though is that it listens on the 
port, accepts the connection, spawns the process and the process talks via 
stdin/out till done, then exits.

What I want is a front-end webserver that realizes mongrel isn't running, 
holds the connection while it starts it, then continues as normal.  I 
can kill the mongrel off later somehow...

Basically I want dynamically spawned FCGI processes, but I've used FCGI 
before which is why I'm now using mongrel :)

An ugly brute force would be to simply watch apache's logs for a 503 error 
and if seen start up mongrel, but that means one user is gonna get a 
broken page...

I don't know enough about mongrel/rails/ruby to know if mongrel can unload 
the majority of that 30mb it's using, but still keep on listening, but if 
someone (Zed? :) wanted to give me some pointers I'd love to give it a try 
:)

-philip


More information about the Mongrel-users mailing list