开发者

Properties of a PHP Worker Pool for Background Processing with Gearman

开发者 https://www.devze.com 2022-12-15 07:13 出处:网络
I did some reading about Gearman and i am wondering if it can be used as a worker pool for background processing. I am interested in a PHP worker pool with the following properties:

I did some reading about Gearman and i am wondering if it can be used as a worker pool for background processing. I am interested in a PHP worker pool with the following properties:

A. Workers should be able to run concurrently

That is, i should be able to have a worker pool and i am开发者_开发知识库 expecting gearman to dispatch multiple workers in separate threads. I might need a worker pool manager that manages the number of workers waiting for an incoming job.

Can gearman provide this? Have i missed the point?

any help appreciated.


This sounds like an ideal use case for gearman, actually.

Essentially you can have 1 or more gearman servers where jobs are sent to, and then you can have 1 or more workers. The workers will connect to the gearman server(s) and ask for jobs. The workers can be on the same machines as the servers or on completely different machines. You could easily have 20 workers all running at the same time, each working on different jobs fetched from gearman servers.

I recommend starting with this presentation to get a good idea of what you can do with gearman:

http://assets.en.oreilly.com/1/event/27/Gearman_%20Build%20Your%20Own%20Distributed%20Platform%20in%203%20Hours%20Presentation.pdf


In Case you warnt to use pure php you could have a Look at https://github.com/qxsch/WorkerPool/

0

精彩评论

暂无评论...
验证码 换一张
取 消