PHP Advance Job Queue

早过忘川 提交于 2019-12-06 06:09:25
Abhinav Singh

You can either go ahead and write your own custom job queue handler. Spawn a separate process per job, and keep collecting the response in the parent process. Restart new jobs when previous one's have finished.

Or alternately you can dig into using Gearman (specially if you have multiple boxes running jobs in parallel). Also do view solutions proposed here on asynchronous-processing-with-php-one-worker-per-job

I disagree with making your own job queue handler. You're going to run into problems down the line that you didn't anticipate and that existing projects have already met and dealt with.

I'd go with something like beanstalkd, build a generic script to handle the jobs in the queue, then spawn $x child processes to go through and process them.

There's also the wordpress job queue - see http://code.trac.wordpress.org/wiki/JobsDocs (I've not used it, so can't vouch for it)

You would be well off writing your own job queue handler.
You could make php ignore_user_abort and make it a daemon process too...

But make sure you have some control over it before you do that.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!