T
T
TBilyn2012-05-15 11:16:16
Yii
TBilyn, 2012-05-15 11:16:16

Asynchronous job queue for PHP?

I am developing a web site on Yii framework, it is planned that the site will be highly loaded (up to 200,000 per day). I will need to process pictures, send mail, etc. Well, you need to do it asynchronously. I've never experienced this before and don't know what to choose. Suggest something.
UPD : Thanks everyone, I'm leaning towards Gearman but also reading up on RabbitMQ

Answer the question

In order to leave comments, you need to log in

9 answer(s)
A
Anton, 2012-05-15
@sHinE

There is a job server - gearman - there was just an article about him recently. PHP works well with it - it can both send tasks to it, and receive and execute it.

S
Sergey Sokolov, 2012-05-15
@sergiks

RabbitMQ , here's about integration with php

E
EXSlim, 2012-05-15
@EXSlim

gear man

A
Anatoly, 2012-05-15
@taliban

3 people per second is not even a very high load.
For desynchronization, you can create a table with tasks in the database (or somewhere else) and then select 10-20 tasks with the crown and process them.

B
Bardus, 2012-05-15
@Bardus

ZeroMq
www.zeromq.org/
Here is a good talk:
www.zfconf.ru/2012/talks/distributed-network-applications-with-zend-framework-2-and-zeromq/

M
MuXaJIbI4, 2012-05-15
@MuXaJIbI4

Why bother with something that doesn't exist yet? :)
and about multithreading, you can try this github.com/amal/AzaThread

S
sad, 2012-05-15
@sad

If your choice still falls on Gearman, I advise you to pay attention to the worker manager github.com/brianlmoon/GearmanManager . We use it on our project, with minor modifications (by the way, also with Yii):

  • a new application class that contains and launches the manager;
  • a new mechanism for parsing the config, so that the manager understands his own options from the Yii config;

At the same time, a couple more tips on working with a manager:
  • do not use the max_worker_lifetime option other than 0. Better to do at the end of the work: This way you can free up resources without fear that the manager will restart the worker in the middle of its active work.
    $this->sendComplete($result);
    exit(0);

  • set auto_update = 0, especially in production.

Good luck.

E
egorinsk, 2012-05-15
@egorinsk

> high load
> 200.000 per day

P
phasma, 2012-05-15
@phasma

If you have only FIFO queues planned, then you can use Gearman, if LIFO is planned, then it will no longer work. In general, Redis is perfect for queues, for example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question