Poll and push in Internet Architecture Design

Source: Internet
Author: User

Poll Method
Poll, also known as round robin, is a data synchronization method that everyone is familiar with. The client periodically queries the server by pinging it to determine whether data is needed. For example, in the Software Update module, the client software needs to regularly query the official website to determine whether there is any updated version. If there is any, remind the user to perform the upgrade. The mail client needs to regularly query the mail server to check whether there are new emails. The RSS reader also needs to constantly query the status of the RSS address. If there is an update, it will get the data back.

When the server does not have data, the poll method will waste a lot of bandwidth. In order to reduce bandwidth, the frequency of poll reduction is usually used, which leads to a long delay of messages and low real-time performance. The interval for checking POP3 mails like Gmail ranges from 10 minutes to 1 hour.

Push method
The problem with poll is that communication channels are unidirectional in many cases. To solve the poll problem, you can design the communication channel as a two-way communication channel, so that the server can actively synchronize data to the client using the push method. Two-way communication channel design, considering the need to penetrate NAT and firewall, many implementations adopt persistent connections. For example, various im implementations: MSN is a persistent connection of TCP, QQ is a persistent connection of UDP imitation, and Gtalk is a persistent link of HTTP imitation.

The server actively pushes data to the client. Currently, two push methods are available:
1. The client first connects to the server and maintains a persistent connection.
2. The server can directly access the client without a persistent connection.
When Nat and firewall are everywhere in China, the 2nd methods are not very feasible, but for some enterprise applications, this method is still good, such as the pubsubhubbub mentioned later.

However, the push method usually requires persistent connections, which is not a small pressure on the server. Although the c10k problem has been well solved, for some large-scale Internet applications, the number of users is hundreds of millions. To maintain TCP connections, too many servers are required. Therefore, in addition to some applications with high real-time requirements, the push method is not widely used. For example, the push method is applied in IM, server monitoring, and other fields.

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.