首页 > 解决方案 > Unicorn Worker 进程下的大量 diagnostic_context 线程

问题描述

我们在每个 Unicorn 工作进程下都有越来越多的 diagnostic_context 线程:

PID:23419 Has 21669 Threads.  Process info: unicornworker[0]-c/etc/unicorn/web.rbproduction-D

PID:23422 Has 19681 Threads.  Process info: unicornworker[1]-c/etc/unicorn/web.rbproduction-D

PID:23425 Has 22521 Threads.  Process info: unicornworker[2]-c/etc/unicorn/web.rbproduction-D

PID:23428 Has 18545 Threads.  Process info: unicornworker[3]-c/etc/unicorn/web.rbproduction-D

这是其中一位工作人员的一些线程列表:

  PID  SPID TTY          TIME CMD
23422 23422 ?        00:02:29 ruby
23422 23424 ?        00:00:00 ruby-timer-thr
23422 27362 ?        00:00:00 diagnostic_con*
23422 27363 ?        00:00:00 diagnostic_con*
23422 27379 ?        00:00:00 diagnostic_con*
23422 27380 ?        00:00:00 diagnostic_con*
23422 27392 ?        00:00:00 diagnostic_con*
23422 27393 ?        00:00:00 diagnostic_con*
23422 27404 ?        00:00:00 diagnostic_con*

在这一点上,增加 Unicorn 的 TaskMax 是权宜之计。为什么会产生这些进程,我们如何防止产生如此大量的进程?

标签: ruby-on-railsrubyunicorn

解决方案


推荐阅读