English 中文(简体)
Properties of a PHP Worker Pool for Background Processing with Gearman
原标题:

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/





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签