Closed Bogdaan closed 8 years ago
The "right way" will depend partly on the software you're using to start the workers with. If you can start multiple instances of a process using a single config, then that's your best bet. You could use the COUNT
environment variable to have PHP-Reqsue start several processes for you, but the current code for that just forks COUNT
workers, then exits, which confuses most software designed to ensure things are still running. You'd have to use a different fork of this project that modifies this behavior in order to use COUNT
reliably (you can find one such fork in my own repos).
@danhunsaker system boot / reboot is not application-level thing. See for example (upstart + ubuntu): https://gist.githubusercontent.com/jasonroelofs/1988020/raw/25f6190e21defd6e092f4a172fb241399f8b3e94/etc-init-resque.conf
Post: http://jasonroelofs.com/2012/03/12/manage-and-monitor-resque-with-upstart-and-monit/
I don't quite follow what you mean by "is not application-level thing"... If you mean "is not Resque's responsibility", then sure, I agree. If you mean "is not 'software [used] to start the workers with'", then I disagree completely - in that case I'm referring to whatever init system software you happen to be using, or whatever additional software that system delegates the worker start-stop to. For example, the post you linked appears to involve upstart (as opposed to SystemV Init) and monit (as opposed to xinet, Supervisor, etc). For more clarity, I'll refer to this type of software as a "daemon manager" from here forward.
Regardless of any of that, your best bet on starting worker pools is still to either start multiple instances directly, using whatever mechanism your daemon manager (upstart, monit, or what-have-you) supports, or to switch to a fork that fixes the behavior of PHP-Resque workers with the COUNT
variable set, and use that.
As to running it daemonized, the daemon manager should background the processes automatically, but if not, just add an ampersand (&
) at the end of the worker command line to force it to the background manually.
@danhunsaker agree with you.
Аnyway, in the case where system is not working without workers - pm2
/ god
/ upstart
can setup initial workers.
Hi, I'm a beginner with this lib, but how to start multiple workers as daemon (just in background) + add system startup scripts (initial workers pool)?
UPD: i use pm2 (and some upstart scripts)