"heavy" Mobile network Performance Disclosure (next)--network protocol and Performance Improvement practice

Source: Internet
Author: User
Tags failover dns entry
<span id="Label3"></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><strong><span style="font-family:宋体; color:black; font-size:16px">Performance of network protocols</span></strong></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">Now it's our turn to actually control things.</span></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">The performance of network processing is not proportional to the addition of delay Time. This is because the intrinsic operation of most network protocols is bidirectional information exchange.</span></p></p><p><p>The remainder of this chapter focuses on understanding why these exchanges of information are generated and how to reduce or even eliminate the frequency of their exchange.</p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black"></span></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"></p></p><p style="text-align:center; line-height:21px; background:white"><p style="text-align:center; line-height:21px; background:white"><span style="font-family:宋体; color:#7f7f7f">Figure 3: Network protocol</span></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><strong><span style="font-family:宋体; color:black; font-size:16px">Tcp</span></strong></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">Transmission Control Protocol (TCP) is a connection-oriented, ip-based transport Protocol. The Error-free Duplex communication channel under the influence of TCP is indispensable for other protocols, such as HTTP or tls.</span></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">TCP</span> <span style="font-family:宋体; color:black">shows a lot of two-way communication that we need to avoid as much as Possible. Some of these can be replaced by the use of extended protocols such as the TCP Fast open protocol, while others can be minimized by adjusting system parameters, such as initializing congested forms. In this section, we will explore both methods to provide the background of some TCP internal components at the same time <span style="background:white">. </span></span></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><strong><span style="font-family:宋体; color:black">TCP Fast Open</span></strong></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">Initializing a TCP connection convention requires 3 times of information exchange, which is what we call the 3-time Handshake.</span></p></p><p><p>TCP Fast Open (TFO) is an extension of TCP that eliminates round-trip delays during the usual handshake.</p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">TCP</span> the <span style="font-family:宋体; color:black">three handshake negotiation operations on the client and the server make it possible for both parties to make robust two-way communication. The most initial SYN information (synchronous Information) represents the connection request of the client, and assuming that the server accepts the request, it returns a Syn-ack message (synchronizing and receiving the message); The client sends an ACK message to answer the Server. At this point, a logical connection is established and the client is able to send the Data. In this case you will notice that at least one RTT delay was introduced during the 3 handshake, which is very good. </span></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black"></span></p></p><p style="text-align:center; line-height:21px; background:white"><p style="text-align:center; line-height:21px; background:white"><span style="font-family:宋体; color:#7f7f7f">Figure 4:TCP3 Second handshake</span></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">From a traditional point of view. There is no other way to avoid the delay caused by a TCP3 handshake other than to recycle the Connection. however, such ideas occur as the introduction of the TCP Fast Open IETF specification Changes.</span></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">TFO</span> <span style="font-family:宋体; color:black">agree that the client sends data before the logical connection is Established. This actually negates the round-trip delay in the 3-time handshake. The cumulative effect of this optimization is Impressive. According to Google's survey, TFO can reduce the loading time of page 40%. Although this specification is only a draft, TFO has been supported by the mainstream browser (above Chrome22) and the platform (Linux3.6 above), and other vendors have pledged to fully support it in the near Future. </span></p></p><p><p></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">TCP Fast Open</span> <span style="font-family:宋体; color:black">is a correction to the 3 handshake protocol, which agrees to have a small amount of data payload (such as HTTP requests) within the synchronous message (SYN messages). </span></p></p><p><p>This valid responsibility is passed to the application server, otherwise the connection handshake is <span style="background:white">complete</span> .</p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">Earlier expansion scenarios like TFO finally failed because of security issues. TFO uses security tokens or cookies to solve the Problem. This means that the client is divided into security tokens (tooken) during the traditional TCP connection handshake, and the security token is expected to be included in the SYN message of the TFO optimization Request.</span></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">For the use of tfo, here are some small warnings.</span></p></p><p><p>The most notable of these is the lack of idempotent guarantees for data requested in the initialized SYN Message. Although TCP guarantees repeated packets (recurring occurrences), It is ignored by the Recipient. however, This guarantee does not apply to the handshake process of the Connection.</p></p><p><p>The solution is now being standardized in the draft specification, but at the same time TFO can still be safely applied to <span style="background:white">idempotent processing. </span></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><strong><span style="font-family:宋体; color:black; font-size:16px">Initial congestion Form</span></strong></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">The initial congestion form is a configurable item of TCP and has a huge potential to accelerate small network transactions.</span></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">The recent IETF specification facilitates the setup of the usual initial congestion form to grow to 3 message segments (such as packets) to 10 segments. The proposal is based on a wide range of research conducted by google, which proves that the setting of this parameter has an average 10% improvement in Performance.</span></p></p><p><p>But suppose the congestion form (cwnd) of TCP is not Described. The purpose and potential impact of such a setup will not be truly understood.</p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">When operating on an unreliable network, TCP guarantees client and server Reliability. This is equivalent to a promise that all data sent out will be received, or at least appear to Be. , packet loss is the biggest obstacle to meeting reliability Requirements. This requires detection, correction, and Prevention.</span></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">TCP</span> <span style="font-family:宋体; color:black">a positive response mechanism was adopted to detect the loss of Packets. That is, every packet sent out should be answered by its intended receiver, assuming that no answer means that the packet is lost during Transmission. </span></p></p><p><p>In the process of waiting for confirmation, the data transmission packet is guaranteed to exist in a special buffer, that is, the congestion form. When this buffer is stuffed, an event called CWnd depletion occurs, and all transmissions stop until the receiver answers and frees up the space to send many other packets.</p></p><p><p>These events are critical in TCP Performance.</p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">In addition to network bandwidth limitations, TCP throughput is <span style="background:white"></span> essentially <span style="background:white">limited by the frequency of CWnd depletion Events. This may be related to the size of the congested form. </span></span></p></p><p><p>When TCP performance peaks, a congestion flush is required to adjust the current network state: congested forms are too big to add the risk of network congestion--excessive congestion in the network condition adds a lot of packet loss, and too little precious network bandwidth will not be fully exploited.</p></p><p><p>logically, the more you know about the network situation, the more you can choose the best congestion form Size.</p></p><p><p>The reality is that key network attributes, such as capacity and latency, are very difficult to measure and constantly changing.</p></p><p><p>also, it would be more complicated to assume that an internet-based TCP connection would need to traverse many networks.</p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">Because of the lack of means to accurately determine the size of the network capacity, instead of TCP through network congestion to determine the size of the congested form.</span></p></p><p><p>When TCP discovers that a packet is missing, it expands the size of the congested form, suggesting that a network somewhere down the line cannot handle the current transfer Rate.</p></p><p><p>By adopting such congestion avoidance mechanisms, TCP finally minimizes the CWnd depletion event to some extent it consumes the allocated capacity for all Connections. So now, finally, We have achieved the Goal. Explains the importance of initial congestion form Parameters.</p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">Network congestion can only be measured by dropping packets.</span></p></p><p><p>A new or spare connection because there is not enough packet loss data to justify creating the <span style="background:white">optimal</span> size of the congested form. TCP takes a sensible approach to <span style="background:white">starting</span> with the size of a congested form with a possible minimum of network Congestion. This initially means that you need to set up 1 shards (about 1480 bytes), and sometimes this is Recommended. And later experiments will demonstrate that a setting of up to 4 is also valid. In practice you also usually find that the initial congestion form is set to 3 message segments (approximately 4kb).</p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">The initial congestion form is not conducive to small network transaction processing. This effect is very easy to explain. In the table, under the 3 message segment Settings. CWnd runs out of time after sending 3 packets or 4k of Data. If the packet is sent continuously, the response will not arrive before any agreed round trip time (rtt), and if the RTT is 100ms, then the effective transfer rate is only a poor 400 bytes/second. Although TCP adjusts its own congestion form to take full advantage of the effective capacity, it will be very slow at the Start. In fact, such a way is called slow start.</span></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">To reduce the performance impact of slow start on smaller downloads, it needs to evaluate the risk return of the initial congestion form Again. That's exactly what Google did, and it found that setting the initial congestion form to 10 segments (about 14kb) would achieve maximum throughput in the smallest network congestion scenario. The real world also proves that this setting can reduce the loading time of page 10% in total, and the round-trip delay of the connection will be improved greatly.</span></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">It is also not easy to change the default value of the initial congestion form. Under most server operating systems, a system-level configuration can only be set by a privileged user, and this is a very small number of applications that cannot even be configured with a client without Permission. It is important to note that a larger initial congestion form can speed up the download on the server side, while the client can speed up the Upload. Assuming the inability to change this setting <span style="background:white">on the client</span> means that special effort should be made to reduce the size of the request Payload.</span></p></p><p><p></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><strong><span style="font-family:宋体; color:black; font-size:16px">Hypertext Transfer Protocol</span></strong></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">This section discusses techniques for reducing high round-trip latency in Hypertext Transfer Protocol (HTTP) PERFORMANCE.</span></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><strong><span style="font-family:宋体; color:black">KeepAlive</span></strong></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">KeepAlive</span> <span style="font-family:宋体; color:black">is an HTTP convention that agrees to synchronize successive HTTP requests to use the same TCP Connection. </span></p></p><p><p>At least one 3-time handshake required by a single-group round-trip request can be avoided, saving dozens of or hundreds of milliseconds per Request. deeper, KeepAlive Another additional but not mentioned advantage is that it retains the current TCP congestion form size between requests, which results in fewer CWnd depletion events Occurring.</p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black"></span></p></p><p style="text-align:center; line-height:21px; background:white"><p style="text-align:center; line-height:21px; background:white"><span style="font-family:宋体; color:#999999">Figure 5:http Pipelining</span></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">In fact, a pipeline distributes network latency across HTTP transactions in a network round-trip.</span></p></p><p><p>For example, 5 pipeline HTTP requests that are connected by a 100-millisecond RTT will produce an average round trip delay of 20 milliseconds, under the same conditions. This average delay of 10 pipeline requests is reduced to 10 milliseconds.</p></p><p><p></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">however, http pipeling has obvious drawbacks that prevent it from being widely used, which is the impact of historically misaligned HTTP proxy support and Denial-of-service attacks.</span><span style="font-family:宋体; color:black"><br><br></span></p></p><p style="text-align:left; line-height:21px; font-family:5px 0; background:white"><p style="text-align:left; line-height:21px; font-family:5px 0; background:white"><strong><span style="font-family:宋体; color:black; font-size:16px">Secure Transport Layer Protocol</span></strong></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">Transport Layer Security (Transport layer Security,tls) is a session-oriented network protocol that agrees to securely exchange sensitive information <span style="background:white">on public networks</span> . Although TLS is effective in terms of secure communications. however, its performance will degrade under high latency networks.</span></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">TLS</span> <span style="font-family:宋体; color:black">the use of a complex handshake protocol consists of two exchange Client-service-side Information. This is why a tls-secured HTTP transmission is noticeably slower. Usually. Discovering a TLS slow is actually complaining about the delay of multiple round trips in its handshake protocol. </span></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black"></span></p></p><p style="text-align:center; line-height:21px; background:white"><p style="text-align:center; line-height:21px; background:white"><span style="font-family:宋体; color:#7f7f7f">Figure 6:dns Query</span></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">typically, The main platform provides a cache implementation to avoid frequent DNS Queries. The semantics of the DNS cache are easy: each DNS response includes a time-to-live (time-to-live,ttl) attribute to declare how long the result will be Cached. The TTL range is usually between a few seconds and a few days, but usually a few minutes.</span></p></p><p><p>A low TTL value. typically, under one minute, it is used to affect load distribution or to reduce the time of server replacement or ISP Failover.</p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><strong><span style="font-family:宋体; color:black">Refresh failed</span></strong></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">Highly available systems often rely on redundant infrastructure hosts in their IP rooms.</span></p></p><p><p>A DNS entry with a low TTL value can reduce the time the client points to the failed host, but at the same time it can cause a large number of additional DNS Queries. So the value of TTL should be a tradeoff between reducing downtime and maximizing client Performance.</p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">There is usually no point in reducing client performance. however, this is an exception when the server Fails. There is an easy way to solve the problem, that is, not to strictly observe the ttl, but to flush the DNS cache only if higher-level protocols such as TCP or HTTP are detected to unrecoverable Errors.</span></p></p><p><p>Such techniques simulate TTL in most scenarios to maintain consistent DNS cache Behavior. however, This almost eliminates the performance penalty in the DNS high-availability Solution.</p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">however, It is important to note that this technical solution is incompatible with other dns-based distributed load Scenarios.</span></p></p><p><p></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><strong><span style="font-family:宋体; color:black">Asynchronous flush</span></strong></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">Asynchronous refresh is a DNS caching method that adheres to the TTL rules that have been set but largely eliminates the delay in querying DNS frequently. In this technique, an asynchronous Dnsclient library such as C-ares is Required.</span></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">This method is very easy. An expired request still returns an old result, but there is a non-clogging DNS query in the background to periodically flush the DNS Cache. This scenario assumes that a plug-in (such as Synchronous) callback is used to query each old DNS data, so this approach is almost unaffected by DNS query latency, but is still compatible with a very many dns-based failover scenarios and distributed load SCENARIOS.</span></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black"></span></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><strong><span style="font-family:宋体; color:black; font-size:16px">Summarize</span></strong></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">To reduce the impact of high latency on mobile networks, you need to reduce the number of network round trips that dramatically add to the latency of the <span style="background:white">mobile network</span> . Using software optimization to focus on minimizing or eliminating round-trip protocol messages is key to overcoming this daunting performance Issue.</span><br></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"><span style="font-family:宋体; color:black">(mobile Network Performance chapter, complete the full text.) )</span><br></p></p><p style="text-align:left; line-height:21px; background:white"><p style="text-align:left; line-height:21px; background:white"></p></p><p><p>1. <span style="font-family:宋体; color:black; max-width:100%">This paper is <span style="max-width:100%">translated</span> by the program Ape architecture</span></p></p><p><p>2. This document is translated from the performance of Open Source software | Secrets of Mobile Network performance</p></p><p><p>3. <span style="font-family:宋体; color:black; max-width:100%">Reprint Please be sure to indicate this article</span> from <span style="font-family:宋体; color:black; max-width:100%">: <span style="max-width:100%">program Ape Architecture</span> (no.:</span><span style="font-family:宋体; color:white; background-color:blue; max-width:100%">archleaner</span> <span style="font-family:宋体; color:black; max-width:100%"> )</span></p></p><p><p><span style="color:#000000; max-width:100%">4. Many other articles please scan the code:</span></p></p><p><p><span style="color:#000000; max-width:100%"></span></p></p> <p><p>"heavy" Mobile network Performance Disclosure (next)--network protocol and Performance Improvement practice</p></p></span>

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.