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

发布于 2024-12-02 06:40:52 字数 1635 浏览 0 评论 0原文

我需要启动 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风柔一江水 2024-12-09 06:40:52

您不想在生产中使用 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.

这是上帝监控/配置文件的示例 与 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:

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 that ships with Resque to run multiple processes, and here's an example for monit.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文