Why so many worker threads?

Tatsuya Ono ononoma at gmail.com
Fri Mar 1 20:54:26 UTC 2013


NewRelic and Airbrake are popular gems which spawns threads.

Unfortunately I don't think there is a silver bullet to detect which
gems are doing that. You have to investigate it step by step. For
example, you can create a new Rails app with the Gemfile(assuming you
use bundler), config and initializers. If you succeeded to reproduce
the problem with the small app, the rest of research would not be
difficult. You remove a gem one by one and restart app and you may
want to make some requests, then check the number of threads. If the
number of threads is reduced, that's would be it.

Or maybe you can grep your gem library directory with some keywords
like "Thread" or "Proc"? If you install gem library to specific path
(--path option on Bundler) for the application, you can avoid look at
other gems installed by other ruby application.
http://gembundler.com/v1.2/bundle_install.html


I don't think that the problem is related to Unicorn though.

Good luck :-)

On 1 March 2013 19:14, Alejandro Riera <ariera at gmail.com> wrote:
>
> >>> >   * screenshot: http://i.stack.imgur.com/U9TFR.png
> >>> >   * unicorn.rb: https://gist.github.com/907th/4995323
> >> which command do you run to show that list?
> >
> > Screenshot? Its `htop` command with tree (F5) view.
>
>
> I have just one worker. If I run top I just see one master and one
> worker. But with htop there are 3 masters and 3 workers, each of them
> with a different pid. This is a surprise to me too. I'm runnnig ruby
> 1.9.2.
> _______________________________________________
> Unicorn mailing list - mongrel-unicorn at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-unicorn
> Do not quote signatures (like this one) or top post when replying


More information about the mongrel-unicorn mailing list