Symfony2 Job Queue or Parallel Processing?

2020-07-22 09:27发布

Does anyone know how to run a number of processes in the background either through a job queue or parallel processing.

I have a number of maintenance updates that take time to run and want to do this in the background.

4条回答
迷人小祖宗
2楼-- · 2020-07-22 10:11

I would recomment Gearman server, it prooved quite stable, it's totally outside of Symfony2, and you have to have server up and running (don't know what your hosting options are), but it distribues jobs perfectly. In skiniest version, it just keeps all jobs in-memory, but you can configure it to use sqlite database as backup, so for any reason server reboots, or gearman deamon breaks, you can just start it again, and your jobs will be perserved. I konw it has been tested with very large loads (adding up 1k jobs per second), and it stood it's ground. It's probably more stable nowdays, I'm speaking from experience 2 yrs ago, where we offloaded some long-running tasks in ZF application to background processing via Gearman. It should be quite self-explanitory how it works from image below:

enter image description here

查看更多
神经病院院长
3楼-- · 2020-07-22 10:11

Take a look at enqueue libraty. There are a lot of transports (AMQP, STOMP, AmazonSQS, Redis, Filesystem, Doctrine DBAL and more) to choose from. Easy to use and feature rich. That would be enough for simple job queue, though if you need something more sophisticated look at enqueue/job-queue. It can run an exclusive job (only one job running at a given time) or a job with sub-jobs, or a job with something to do after it has been done.

Of course, there is a bundle for it

查看更多
Luminary・发光体
4楼-- · 2020-07-22 10:25

Checkout RabbitMq. It's the most popular option according to knpbundles.com

查看更多
唯我独甜
5楼-- · 2020-07-22 10:29

Take a look at http://github.com/mmoreram/rsqueue-bundle

Uses Redis as queue core and will be mantained.

查看更多
登录 后发表回答