[Mongrel] Unix Domain Sockets + Fork for improved scalability

Tim Harper lists at ruby-forum.com
Fri Aug 1 01:53:46 EDT 2008


I found your patch while looking for a solution that we've needed to
decrease startup times, take advantage of COW, have completely graceful
restarts ( < 0.1 seconds downtime max, new server must be ready to
immediately start processing requests before the old server is booted
out ), and scheduling of garbage collection between results.

Your patch turned out to be a very good fit for all 4 of these arenas :)

Though, I did need to do some refactoring and additional work on what
you've started.

The main parts of my improvements are the "-R" flag
(Mongrel::UnixDispatchServer only), graceful shutdowns, and ability to
specify pre/post fork hooks.  The -R flag is like a hostile takeover
restart.  A new server boots up, gets all loaded and ready to go, then
sends a TERM signal to the old process.  The old process IMMEDIATELY
stops listening on it's port, and waits for it's children to finish
their requests.  As soon as they are all done, the server shuts down.

My changes are available here in my fork of mongrel:


Here's the script I use to start up mongrel:


I'd still like to see some additional cleanup and get some input on the
changes I've made.  Additionally, I did all this while working for my
company Lead Media Partners, so they should get a plug for this

Peace and harmony,

Posted via http://www.ruby-forum.com/.

More information about the Mongrel-users mailing list