At GitHub we have a ride-along config that spawns a thread and periodically checks for overgrown Unicorn workers, sending them a QUIT when necessary:
https://gist.github.com/788a4b50569773de5fa6 Hope this helps! Tom On Wed, Jul 28, 2010 at 1:13 PM, Josh <[email protected]> wrote: > So github mentions they use God and/or Monit to send unicorn workers > the QUIT signal if they get too big: > > "When a worker is using too much memory, god or monit can send it a > QUIT signal. This tells the worker to die after finishing the current > request. As soon as the worker dies, the master forks a new one which > is instantly able to serve requests. In this way we don’t have to kill > your connection mid-request or take a startup penalty." > http://github.com/blog/517-unicorn > > .... but they don't mention how. So, how do you think they're doing > that? > > The weirdness comes up because when you start unicorn it starts a > master process which then forks a bunch of workers -- and it's these > workers that we want to monitor for growth. > > Here's a ps example with one master and one worker: > $ ps aux|grep unicorn > jsharpe 15918 1.0 3.1 59672 15912 pts/0 S+ 19:07 0:00 > unicorn master -E stage - > l0.0.0.0:8080 > jsharpe 15954 0.0 4.5 75432 22812 pts/0 R+ 19:07 0:00 > unicorn worker[0] -E stage -l0.0.0.0:8080 > > Assume there are multiple workers that need to be monitored. Any > suggestions? > > Thanks! > > -- > You received this message because you are subscribed to the Google Groups > "god.rb" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/god-rb?hl=en. > > -- Tom Preston-Werner github.com/mojombo -- You received this message because you are subscribed to the Google Groups "god.rb" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/god-rb?hl=en.
