PHP高级作业队列 [英] PHP Advance Job Queue

查看:184
本文介绍了PHP高级作业队列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用cron在一天内创建了2000个作业的脚本(意味着是服务器端并自动执行所有作业。)

I am making a script with 2000 jobs in a day using cron (means that is server side and automatically do all jobs.)

但是作业需要运行同时10(或指定的作业数)作业。

but the job require to run simultaneously 10 (or specified no. of jobs ) jobs .

就像IDM(互联网下载管理器)有一个队列功能,它一次运行多个作业,如果有任何完成它启动另一个。我想要这样的东西。

like if u see IDM(internet download manager ) there is a queue function it run multiple jobs at a time and if any complete it start another . i want something like this ..

我该怎么做?

推荐答案

您可以继续编写自己的自定义作业队列处理程序。每个作业生成一个单独的进程,并继续收集父进程中的响应。

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.

或者您也可以深入使用 Gearman (特别是如果您有多个箱子并行运行作业)。此外,您还可以在异步处理与php-one中查看解决方案-worker-per-job

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

这篇关于PHP高级作业队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆