Several resque operating modes creating additional processes

I need to run 4 work frames, so I used the 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, having switched to the web interface, in fact, he began work with 8 people. There were two parent processes with 4 child processes each. Below is a view of the process tree:

  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] 

Failed to find out what causes the additional process?

+6
source share
1 answer

You do not want to use the parameter COUNT = n in production, since it starts each worker in the 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 thread. Hitting ctrl-c should be sufficient to stop them all. 

Here is an example of a God monitoring / configuration file that comes with Resque to run several processes, and here is an example for monit .

+13
source

Source: https://habr.com/ru/post/896419/


All Articles