A good way to get the current progress in a loop on other pages

Source: Internet
Author: User
Maybe the topic is a little general, the demand is like this.
There is a mass mailing feature. Sometimes the group is sent to hundreds of customers, so it has to be cycled hundreds of times. At the same time there is a page to see in real time the progress of the transmission, dynamic display sent to the first few. The process ID is different each time the message is sent.
The current processing logic for the display page is how much the total number of this process ID in the message table is queried via Ajax and then returned in the page display. This feeling is too inefficient. Once again, check. Excuse me, is there any other good way?
I tried to write the current number of cycles into the session in a loop, and then showed the page read the session value directly, but each time it showed the final result.
I don't know much about PHP threads. Please advise.


Reply to discussion (solution)

Useful Memchache or other cache, write cache in loop script; Show page ajax request background Read cache

Not with Memchche or other caches, I'm going to try HTML5 's localstorage don't know can not.

In the ordinary way, there is no good way. Also do not recommend the landlord to make complex. Proposed landlord still use ajax+ database to get progress, although not so high real-time, but enough to meet the engineering needs. Sending mail can be multi-threaded, which is much more efficient.
Or do not use multithreading, the use of more simple bar. You can http://localhost/xxx.php launch multiple PHP files for sending.

  • 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.