On 6/10/10 8:30 AM, Frederic Hardy wrote:
On 06/10/2010 17:20, Brian Moon wrote:
The big difference is that different processes do different jobs in
Gearman. All PHP workers in fpm just run what ever code is handed to
them. How do you handle that?
Threading ;) ?
Definitely not. Gearman is actually the answer to a lot of problems
where people think they need threads.
As far as different workers doing different jobs, I don't see the issue
here. fpm doesn't need to know the details. All it has to know is that
it needs to maintain pools of php processes. Each pool would correspond
to a Gearman job. The workers can take care of registering themselves
with gearmand. All fpm has to do is start up and maintain N processes
per worker pool.
worker1.path = /path/to/worker1.php
worker1.pm = dynamic
worker1.pm.max_children = 10
worker1.pm.start_servers = 5
worker2.path = /path/to/worker2.php
worker2.pm = dynamic
worker2.pm.max_children = 4
worker2.pm.start_servers = 2
or however you do multiple nested conf blocks in the fpm .ini file.
In fact, this may not need to be gearman-specific. We could just call
it cli job management or something like that if we left it completely up
to the workers to register with the gearmand. Alternatively, we could
make fpm Gearman-aware and register the workers from there, but I am not
sure I see much of an advantage to that other than making the worker
code slightly simpler.