多个resque工作模式创建额外的进程
我需要启动 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 个工作人员。有两个父进程,每个进程有 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]
无法弄清楚是什么导致额外的进程启动?
I need to start 4 resque workers so i used following command
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
But going to web interface, it was actually starting 8 workers. There were two parent processes with 4 child processes each. Following is tree view of the processess:
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]
Couldn't figure out what is causing extra process to start?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不想在生产中使用 COUNT=n 选项,因为它在线程中运行每个工作线程而不是单独的进程 - 这不太稳定。
Resque 官方文档:
这是上帝监控/配置文件的示例 与 Resque 一起运行以运行多个进程,以及 这是 monit 的示例。
You don't want to use the COUNT=n option in production, as it runs each worker in a thread instead of a separate process - which is much less stable.
Official Resque docs:
Here's the example God monitoring/configuration file that ships with Resque to run multiple processes, and here's an example for monit.