stop/start workers "by need"
normalperson at yhbt.net
Fri Oct 29 13:40:51 EDT 2010
"Anton A. Vesnin" <antonvesnin at gmail.com> wrote:
> Hello to everybody.
> I making shared hosting for rails and rack applications. For app. server i
> userd phusion passenger, but after some issues with that, want to migrate to
> Is there any way to make unicorn stop all workers and start them on first
> request? It'll be really great to have this opportunity.
Hi Anton, there's no current way to do this.
Unlike Apache/Passenger, Unicorn should only be tuned for backend
requirements, never to actual connected clients. Unicorn isn't too
different from prefork Apache when serving requests, it's just the
"marketing" for Unicorn focuses _very_ strongly on its limitations :)
On a memory-constrained box, maybe tailing logs or similar and sending
TTIN/TTOU signals to increment/decrement workers as needed can work. A
smarter version of this would even recognize which endpoints are more/less
expensive and tune the workers accordingly.
A dumb version of this would just be a cronjob that
increments/decrements worker depending on the time of day. If you're
running batch processes at off hours, maybe the dumb version is all you
I'm strongly against having this logic in Unicorn itself since apps
behave wildly differently depending on how they're implemented. And
most deployments I've supported over the years were better off with
fixed/dedicated resources and letting the OS manage things.
> Reply with Cc:, pleace. Thank you.
More information about the mongrel-unicorn