I am running gearman worker to distribute background jobs to multiple workers. To monitor those background jobs and restaart upon crash, we are using supervisord as the process management system.
The gearman worker code is pretty much simple as official example:
$worker = new GearmanWorker();
$worker->addServer($config["gearman.host"],$config["gearman.port"]);
$worker->addFunction("config_job", "run_config_job");
while ($worker->work());
For the workers, I was expecting, during a job execution the CPU usage will be high, after completion if will become low during the waiting time. But interestingly, for long running processes, it contains increased CPU usage over time.
Does anyone has any idea what the main reason behind incremental CPU usage over time is?
Also, as the tasks are run on aws ec2 small instances, how many workers can effectively run in parallel in a single workers-only instance on average?