Simple understanding of round robin, long polling, and long connection

Source: Internet
Author: User

Round robin: common Ajax regularly sends requests to the service. It is generally implemented using setinterval of JavaScript. This method has low real-time performance and high server pressure.

Long polling: such as comet long polling. The client sends an Ajax request to the server. After connecting to the server, the client's participating server keeps connected. When the server has an update message, it is immediately sent to the client, and the connection is closed. After the client completes processing, it will send a new Ajax request to the server.(If the server does not return a message for a long time, the connection times out and the client sends a new Ajax request to the server.). This method has high real-time performance and low latency.

Persistent connections: such as comet persistent connections. The client sends an Ajax request to the server. After the client connects to the server, the client and the server remain connected. When the server has an update message, it will immediately send it to the client, and the connection will continue.(If the server does not return a message for a long time, the connection times out and the client sends a new Ajax request to the server.). This method is also highly real-time.

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.