Difference between using Message Queuing vs Plain Cron Jobs with PHP

We have a great web application built in PHP. This application allows you to schedule tweets and messages on the wall, as well as send emails that come from the server.

By "planned" I mean that these are PHP scripts scheduled to run at a specific time using cron . There are about 7 PHP files that perform the above tasks.

I heard about message queues. Can someone explain if the message queues are consistent in this scenario? Do message queues execute PHP scripts? or do we need to set this up completely differently? What are the advantages / disadvantages?

+6
source share
1 answer

Using Crontab to create asynchronous tasks (asynchronously from your PHP code) is a basic approach in which using the task / task queue manager is complex and gives you more control, power and scalability / elasticity.

Crontab is very easy to manage, but does not offer much functionality. This is best for scheduled tasks than for asynchronous tasks.

Deploying the task queue (and its Celery (combined with RabbitMQ ) in Python projects, on the other hand, I'm sure you can find something similar in the PHP world.

+5
source

Source: https://habr.com/ru/post/904290/


All Articles