vend / php-resque

PHP port of resque (Workers and Queueing)
MIT License
32 stars 9 forks source link

daemonization/worker pool strategy examples #7

Open wotek opened 9 years ago

wotek commented 9 years ago

Hey man, original fork had easy-to-use bin tool that did daemonization/worker pool strategy quite well. Can you provide an example how to achieve same thing with your lib?

dominics commented 9 years ago

Personally, I'm subclassing the Worker to fire HTTP requests at an FPM pool for every job class. That way, FPM is doing the forking and process management - you get adaptive process pools, and safety features like "emergency restart in case of opcode cache destruction".

I do want to get the new Symfony2 CLI worker process up to scratch with the features in the old fork though. The worker command is intended to daemonize and have the same capabilities as the old bin tool.

wotek commented 9 years ago

So correct me if I'm wrong. You do trigger job through http? or.. ? Can you provide some example here?

dominics commented 9 years ago

Yeah, you're right. These days we are using benmanns/goworker as the daemonized worker. We enqueue using PHP, from our regular framework. The golang workers dequeue and fire HTTP requests at a locally-bound FPM pool (say, 127.0.0.1:12345), running a regular old framework controller.

That stuff is a bit sprawling and large for me to copy+paste. I'm hoping to get an example "marshalling" worker in the codebase eventually, as an example.

wotek commented 9 years ago

Sounds interesting - I've seen benmanns/goworker I think I'm going to give it a spin in my spare time.