Forking off the unicorn master process to create a background worker

Russell Branca chewbranca at
Tue May 25 14:53:02 EDT 2010


I'm trying to find an efficient way to create a new instance of a
rails application to perform some background tasks without having to
load up the entire rails stack every time, so I figured forking off
the master process would be a good way to go. Now I can easily just
increment the worker count and then send a web request in, but the new
worker would be part of the main worker pool, so in the time between
spawning a new worker and sending the request, another request could
have come in and snagged that worker. Is it possible to create a new
worker and not have it enter the main worker pool so I could access it

I know this is not your typical use case for unicorn, and you're
probably thinking there is a lot better ways to do this, however, I
currently have a rails framework that powers a handful of standalone
applications on a server with limited resources, and I'm trying to
make a centralized queue that all the applications use, so the queue
needs to be able to spawn a new worker for each of the applications
efficiently, and incrementing/decrementing worker counts in unicorn is
the most efficient way I've found to spawn a new rails instance.

Any help, suggestions or insight into this would be greatly appreciated.


More information about the mongrel-unicorn mailing list