Difference between using Message Queue vs Plain Cron Jobs with PHP

前端 未结 1 1903
夕颜
夕颜 2021-02-06 07:53

We have a large web application built on PHP. This application allows scheduling tweets and wall posts and there are scheduled emails that go out from the server.

By \'s

1条回答
  •  北荒
    北荒 (楼主)
    2021-02-06 08:44

    Using Crontab to make asynchronous tasks (asynchronous from your PHP code) is a basic approach where using a job/task queue manager is an elaborate one and give you more control, power and scalability/elasticity.

    Crontab are very easy to deal with but does not offer a lot of functionalities. It is best for scheduled jobs rather than for asynchronous tasks.

    On the other hand, deploying a Task queue (and its message broker) require more time. You have to choose the right tools first then learn how to implement them in your PHP code. But this is the way to go in 2011.

    Thank God, I don't do PHP but have played around with Celery (coupled with RabbitMQ) on Python projects ; I am sure you can find something similar in the PHP world.

    0 讨论(0)
提交回复
热议问题