PHP uses the term "task queue" to mean what exactly is the task queue

Source: Internet
Author: User
The most recent one heard a word: task queue.
What does the task queue mean?
I myself have an understanding, that is, for example, users use mail registration, registration is successful to send a message to the registered mailbox. Because sending messages is a time-consuming operation, placing messages asynchronously in the queue does not occupy the main thread. Is the use of the queue a scenario like this?
Ask the great God for answers, preach!

Reply content:

The most recent one heard a word: task queue.
What does the task queue mean?
I myself have an understanding, that is, for example, users use mail registration, registration is successful to send a message to the registered mailbox. Because sending messages is a time-consuming operation, placing messages asynchronously in the queue does not occupy the main thread. Is the use of the queue a scenario like this?
Ask the great God for answers, preach!

Yes, u 2 right.

can provide you with a plan to maintain a list in the Redis, business code to the list to insert e-mail address, another script from the Redis inside read the email address, specifically to do the job of sending mail.
I wrote a blog that gives examples of PHP and Redis implementation queues: http://upliu.net/php-use-redis-as-queue-service.html

In addition, a naturally asynchronous development language, such as node. JS, does not block the running of the script while it is making a network request (the scenario for the main problem is sending the message).

Of course it is also possible to use multi-process, fork out a child process inside the main process, and then the child process to send the message, the main process continues to execute its logic. But I think it hurts so slightly

That's the way it is. But I don't usually use PHP to do this kind of continuous operation.

My understanding of what to do in order is to use the team example.
Even if you are Keiko threads, why not more than a few sub-threads parallel processing?
Slightly shallow, seeking light spray.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.