gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 20:31:29 26 4
gpt4 key购买 nike

我需要启动 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com