The difference between redis queues and scheduled tasks to perform batch operations.

before the project encountered a problem, we need to send text messages in batches, so we have to query the database according to certain conditions, and then get the mobile phone number to send the message.
uses a loop to query the data when it is done, and as a result, the whole project is stuck. Then due to the configuration of the server can not use the redies queue to achieve this function, and then came up with a way is to store the condition, put it in a file, and then use the scheduled task to execute the condition every 10s. In fact, I have a question here, what is the difference between doing so and putting it directly into the redis queue to execute. I hope to give an easy-to-understand explanation.

Php
Apr.09,2021

Hey? Can't programmers write multithreading anymore?

if there is a difference, there is a difference in performance. The queue of redis is controllable and complete. Scheduled tasks are easily disturbed, and the operation logic of the program needs to trust an external program. The controllability is low

.

there is no difference in principle. Storage redis is storage, and storage file is also storage.

just say which solution is easier and faster.

what you want to do here is to asynchronize the operation of sending text messages, so it's OK to put it on file, redis, memcached, db. Just according to your actual environment, combined with your own preferences, can. As long as there are no errors in the program, it is convenient to manage.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3d321-2c37f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3d321-2c37f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?