resque - 多个resque工作模式创建额外的进程

标签 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个worker。有两个父进程,每个进程有 4 个子进程。以下是进程的 TreeView :

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.

Here's the example God monitoring/configuration file与 Resque 一起提供以运行多个进程,以及 here's an example for monit .

关于resque - 多个resque工作模式创建额外的进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7272592/

相关文章:

heroku - Resque Scheduler发送到队列但不处理

ruby-on-rails - Resque:我如何只对一个特定的队列使用特定的工作人员

ruby-on-rails-3 - 如何销毁resque worker 排队的工作?

resque - 将 Dokku 与 Resque 结合使用

ruby-on-rails-3 - 尝试在 rake 任务中启动 redis 和 resque 调度程序

ruby-on-rails - 设置 resque .perform 方法的期望。任务在回调中排队

ruby - 不承认 resque worker 已经启动

ruby-on-rails-3 - Resque with Rails 3 + Heroku + RedisToGo 给出 Postgresql 错误

ruby-on-rails - 如何查明一组 Resque 作业是否已完成?

ruby - 从 Linux 上的 Ruby 和 Resque 捕获段错误回溯