我需要启动 4 个 resque 工作人员,所以我使用了以下命令
bundle exec rake environment resque:workers RAILS_ENV=production COUNT=4 QUEUE=* VERBOSE=1 PIDFILE=tmp/pids/resque_worker.pid >> log/resque_worker_QUEUE.log
但是进入Web界面,它实际上启动了8个worker。有两个父进程,每个进程有 4 个子进程。以下是进程的树视图:
ruby /code_base/bundle/ruby/1.9.1/bin/rake environment resque:workers RAILS_ENV=production COUNT=4 QUEUE=* VERBOSE=1 PIDFILE=tmp/pids/resque_worker.pid
\_ [ruby]
\_ resque-1.15.0: Waiting for *
| \_ [ruby]
\_ resque-1.15.0: Waiting for *
| \_ [ruby]
\_ resque-1.15.0: Waiting for *
| \_ [ruby]
\_ resque-1.15.0: Waiting for *
\_ [ruby]
ruby /code_base/bundle/ruby/1.9.1/bin/rake environment resque:workers RAILS_ENV=production COUNT=4 QUEUE=* VERBOSE=1 PIDFILE=tmp/pids/resque_worker.pid
\_ [ruby]
\_ resque-1.15.0: Waiting for *
| \_ [ruby]
\_ resque-1.15.0: Waiting for *
| \_ [ruby]
\_ resque-1.15.0: Waiting for *
| \_ [ruby]
\_ resque-1.15.0: Waiting for *
\_ [ruby]
无法弄清楚是什么导致额外的进程启动?
您不想在生产中使用 COUNT=n 选项,因为它在线程中运行每个工作线程而不是单独的进程 - 这不太稳定。
Resque 官方文档:
Running Multiple Workers
At GitHub we use god to start and stop multiple workers. A sample god configuration file is included under examples/god. We recommend this method.
If you'd like to run multiple workers in development mode, you can do so using the resque:workers rake task:
$ COUNT=5 QUEUE=* rake resque:workers
This will spawn five Resque workers, each in its own process. Hitting ctrl-c should be sufficient to stop them all.
这是上帝监控/配置文件的示例 https://github.com/resque/resque/blob/master/examples/god/resque.god随 Resque 一起提供以运行多个进程,以及这是 monit 的示例 https://github.com/resque/resque/blob/master/examples/monit/resque.monit.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)