Analysis of polling (Polling) and push (long-polling) service

Source: Internet
Author: User
Polling (Polling) refers to whether the server side is not updated, the client (usually refers to the browser) are sent to the request to query, the results may be the server side of the new update or nothing, just return empty information. Regardless of the outcome, the client finishes processing the next round of polling at the next scheduled time. Push or call Long connection (long-polling) service its clients do not do polling, the client immediately after the launch of a request to suspend, until the server has updates, the server will actively push information to the client. Before the server has updates and pushes information over the cycle, the client will not have a new redundant request to occur, the server side of the client is also nothing to do, only the most basic connection information, once the server has updates will be pushed to the client, the client will be the corresponding processing, processing, and then restart the next round of requests.

For example, it is clear that polling mode, assuming that the client polls every 2 seconds, the client sends a request every 2 seconds, and the corresponding server side responds to the client's request every 2 seconds. In fact, the server may be 1 seconds after the update, it may be 1 minutes after the update. For 1 seconds to have the update, the client will have at least 1 seconds delay, and 1 minutes after the update, only the last query meaningful, this one-minute polling is not necessary, both the server side and the client have a waste of resources. Push mode, the client immediately suspends waiting for server-side response after sending a request, maybe 1 seconds, or 10 seconds, or 1 minutes. If the server side is 1 seconds to update, then to 1 seconds when the client immediately received the update, if it is 1 minutes to update, then the entire one-minute client only request once, the server will only be the corresponding once, this is the difference with polling is very clear.

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.