Gearman is a system to run jobs on multiple servers. We at
YMC are working know to integrate gearman in our cluster solution. Since we're a PHP shop, the jobs should be written in PHP.
There already is a solution with the
gearman PHP extension by
James M. Luedke. But I wanted to run multiple workers on one machine and having them use an opcode cache. The solution is a dedicated PHP binary (SAPI), which runs many worker threads in one process.
The
code (see /sapi/gearman_worker) in branch gearman_worker is already usable and I'd be happy to receive comments on it. After all I'm not (yet) a C expert.
TODOS:
- graceful stop on SIGTERM
- include the possibility to run cron-like scripts in a loop
- pause, if available memory is too low
- documentation
- get it into upstream