Why so many worker threads?

Eric Wong normalperson at yhbt.net
Fri Mar 1 23:05:02 UTC 2013

Alexey Chernenkov <laise at pisem.net> wrote:
> 2013/3/1 Eric Wong <normalperson at yhbt.net>:
> > Alexey Chernenkov <laise at pisem.net> wrote:
> >>
> >> Can anyone explain why my Unicorn installation (for RoR site) have so
> >> many worker threads?
> >>   * screenshot: http://i.stack.imgur.com/U9TFR.png
> >>   * unicorn.rb: https://gist.github.com/907th/4995323
> >>
> >
> > It's probably some gem/library you're using which spawns threads behind
> > your back.  Ruby 1.9/2.0 only has one extra thread per-process for
> > accepting signals.
> >
> Could you advise me how I can determine which gem causes the problem?

What Tatsuya said.

Really, you should never hesitate to grep/scan/read the source of
_everything_ you're running.

For C extensions, check for the pthread_create() function, too.  Also,
any existing libraries your C/FFI extensions might link to...

If you're on Linux, you can probably track it down a little faster via
"strace -f -e clone"  (clone() is the underlying syscall used for both
fork() and pthread_create()).

More information about the mongrel-unicorn mailing list