1, what happened to the TCP protocol?
In current Internet applications, the data transmission of the Web platform (to be precise, client/server applications based on HTTP and its extended protocols) is based on the TCP protocol.
However, the TCP protocol requires a three-way handshake before establishing a connection (see Figure 1 below. For more detailed principles, please see "Theory Classics: Detailed Explanation of the Three-way Handshake and Four-Wave Process of TCP Protocol"). If you need to improve the security of data interaction, Not only increase the Transport Layer Security Protocol (TLS), but also increase more handshake times (see Figure 2 below).
▲ Figure 1-TCP three-way handshake principle diagram
▲ Figure 2-TLS initialization handshake principle diagram
As the principle demonstrated in the above two figures, the cost of establishing TCP protocol connection is relatively high.
Therefore, the general stable network transmission is through TCP, but when the network infrastructure itself has become more and more perfect, the problems of the TCP design itself are exposed, especially in the weak network environment, so we have to Consider some new possibilities.
(This article is published synchronously at: http://www.52im.net/thread-2816-1-1.html)
2, QUIC protocol debut
Contrary to TCP, UDP protocol is a connectionless protocol. After the client sends a UDP packet, it can only "assume" that the packet has been received by the server. The advantage of this is that there is no need to confirm the data packet at the network transmission layer, but the problem is that to ensure the reliability of data transmission, the application layer protocol needs to complete the confirmation of the packet transmission by itself.
At this time, the QUIC protocol is on the stage.
QUIC is the abbreviation of Quick UDP Internet Connections, a new transmission protocol invented by Google.
Compared with TCP, QUIC can reduce latency. The
QUIC protocol can complete the creation of a connection (including TLS) in 1 to 2 packets (depending on whether the connected server is new or known) (as shown in Figure 3 below).
▲ Figure 3-QUIC protocol handshake schematic diagram
On the surface: QUIC is very similar to TCP + TLS + HTTP/2 implemented on UDP. Because TCP is implemented in the operating system kernel and middleware firmware, it is almost impossible to make major changes to TCP (TCP protocol stack is usually implemented by operating systems, such as Linux, Windows kernel or other mobile device operating systems. Modify TCP The agreement is a huge project, because the realization of each device and system needs to be updated). However, because QUIC is built on UDP, there is no such restriction. QUIC can achieve reliable transmission, and compared to TCP, its flow control function is in user space instead of kernel space, so users are not limited to CUBIC or BBR, but can choose freely, and even adjust freely according to application scenarios optimization. Compared with the existing TCP + TLS + HTTP/2 solution,
QUIC has the following main features:
1) uses cache to significantly reduce the connection establishment time;
2) improves congestion control, from kernel space to user space;
3) Multiplexing without head of line blocking;
4) forward error correction, reducing retransmission;
5) smooth connection migration, and changes in network status will not affect connection disconnection.
It can be seen from the figure that the bottom layer of QUIC replaces TCP through the UDP protocol, and the upper layer only needs a layer of HTTP/2 API for interacting with the remote server. This is because the QUIC protocol already includes multiplexing and connection management, HTTP API only need to complete the analysis of the HTTP protocol.
For detailed explanation of QUIC, please see: "Technical Literacy: A New Generation of UDP-based Low Latency Network Transport Layer Protocol-Detailed Explanation of QUIC".
3, the goal of the QUIC protocol
The main purpose of the QUIC protocol is to integrate the reliability of the TCP protocol and the speed and efficiency of the UDP protocol.
A picture to understand the advantages of the QUIC protocol:
For Google, optimizing the TCP protocol is a long-term goal. QUIC aims to create an independent connection almost equivalent to TCP, but with low latency, and multiplexing similar to SPDY Streaming protocols have better support. If the features of the QUIC protocol prove to be effective, these features may be migrated to subsequent versions of the TCP and TLS protocols (both of them have a long development cycle).
It is worth noting that although in theory, if the features of QUIC are proven to be effective, these features may be migrated to subsequent versions of the TCP protocol, but in view of the fact that the TCP protocol has been used in Internet communications for decades Monopoly status and heavy historical retaliation accumulated over so many years, it is quite difficult to fundamentally optimize or improve the TCP protocol (perhaps, some things, you can only think about it, IPV6 has been shouting for so many years, not the same Not popular...).
4, QUIC protocol is so good, can it be switched to QUIC on a large scale? There is always a certain gap between the ideal and reality of
: Although has been promoted and applied for many years, the QUIC protocol has not yet reached the stage of mass popularization. The QUIC on the IETF is still a draft, and there are two Google QUIC and IETF QUIC. An unstable agreement.
Moreover, QUIC also faces the following challenges:
1) In small places, routing blocks UDP port 443 (this is exactly the port deployed by QUIC);
2) There are too many UDP packets. Due to QS restrictions, it will be mistaken for an attack by service providers. UDP The packet is discarded;
3) Neither the router nor the firewall is ready for QUIC.
5, QUIC protocol practice
Chrome browser has experimentally supported the QUIC protocol since 2014. You can enter chrome://net-internals/quic in the Chrome browser to check whether the QUIC protocol is already supported. If it is not yet supported, you can enable it in chrome://flags/enable-quic. After
starts the Chrome browser to support the QUIC protocol, you can view some QUIC connections of the current browser in chrome://net-internals/quic. Of course, only Google services currently support the QUIC protocol (such as YouTube, Google.com).
Google shared some results about the implementation of the QUIC protocol in a 2015 blog post. These advantages are more prominent in video services such as YouTube: users report that the QUIC protocol can reduce the rebuffering time by 30% when watching videos. .
6. I want to try the QUIC protocol, what can I do?
currently supports QUIC protocol web services only after version 0.9 of Caddy. Other commonly used web services such as nginx, apache, etc. have not yet begun to support.
The entire QUIC protocol is more complicated, and it is still more difficult for the author to fully implement a set by yourself.
So first look at what open source implementations are.
1) Chromium:
is officially supported. Naturally, there are many advantages, and Google officially maintains the basicThere is no pit, you can follow chrome to update to the latest version at any time. But compiling Chromium is more troublesome, it has a separate set of compilation tools. It is not recommended to consider this plan for the time being.
2) proto-quic:
is a QUIC protocol part stripped from chromium, but its github homepage has announced that it is no longer supported and is only for experimental use. It is not recommended to consider this option.
3) goquic:
goquic encapsulates the go language package of libquic, and libquic is also stripped from chromium. It has not been maintained for several years and only supports quic-36. Goquic provides a reverse proxy. The test found that the version of QUIC is too low and the latest Chrome is no longer supported. It is not recommended to consider this option.
4) quic-go:
quic-go is a QUIC protocol stack written entirely in go. The development is very active. It has been used in Caddy and is licensed by MIT. It is currently a better solution.
So, for small and medium-sized teams or individual developers, the most recommended solution is the last one, that is, using caddy to deploy QUIC. The caddy project is not intended to implement QUIC specifically, it is used to implement a visa-free HTTPS web server (caddy will automatically renew the visa certificate). And QUIC is just a subsidiary function of it (but the reality is-it seems that more people use it to implement QUIC).
From the technical trend of Github, there are more and more open source resources about QUIC. If you are interested, you can study and study one by one: https://github.com/search?q=quic
7. Summary of this article
QUIC protocol is pioneering use As the underlying transport protocol, UDP protocol reduces network delay through various methods.
Although the QUIC protocol is currently running on some larger websites, it is still a long way from being popularized on a large scale. It is expected that the QUIC protocol specification will become the final draft and will be used in browsers and other browsers other than Google Chrome. It can also be implemented in the application server.
8, reference materials
"Technical Literacy: A New Generation of UDP-based Low Latency Network Transport Layer Protocol-QUIC Detailed Explanation"
"Make the Internet Faster: A New Generation of QUIC Protocol in Tencent's Technical Practice Sharing"
"Qiniu Cloud Technology Sharing: Use QUIC protocol to realize real-time video live broadcast with 0 lag! "Z5z
Google's "Next generation multiplexed transport over UDP" document:
Next generation multiplexed transport over UDP.pdf (563.01 KB)
9, series of articles
This is the tenth article in the series, the outline of this series of articles is as follows:
" Introduction to Network Programming Lazy People (1): Quickly Understand Network Communication Protocol (Part 1)"
"Introduction to Network Programming Lazy People (2): Quickly Understand Network Communication Protocol (Part 2)"
"Introduction to Network Programming Lazy People (3) : A quick understanding of the TCP protocol is enough"
"Network Programming Lazy's Introduction (4): Quickly understand the difference between TCP and UDP"
"Network Programming Lazy's Introduction (5): Quickly understand why UDP is sometimes better than TCP Advantages"
"Introduction to network programming lazy (6): The most popular hub, switch, router function principle introduction"
"Introduction to network programming lazy (7): Explain the basics, fully understand HTTP protocol"
"Network programming lazy Introduction (8): Teach you how to write TCP-based Socket long connections"
"Introduction to Network Programming Lazy People (9): Popular explanation, with IP address, why use MAC address? "Z5z
"Introduction to Network Programming Lazy People (10): Time to soak in the urine, quickly understand the QUIC protocol" (this article)
Appendix: More network programming related materials recommended
"TCP/IP Detailed Explanation-Chapter 11·UDP: User Datagram Protocol"
"TCP/IP Detailed Explanation-Chapter 17 TCP: Transmission Control Protocol"
"TCP/IP Detailed Explanation-Chapter 18 TCP Connection Establishment and Termination"
"TCP/IP Detailed Explanation-Chapter 21 ·TCP Timeout and Retransmission"
"Technical Past: The TCP/IP Protocol That Changed the World (Precious Pictures, Mobile Phones)"
"Easy to Understand-Deep Understanding of TCP Protocol (Part 1): Theoretical Foundation"
"Popular Easy-to-understand-in-depth understanding of TCP protocol (part 2): RTT, sliding window, congestion handling"
"Theoretical Classics: Detailed Explanation of the Process of Three-way Handshake and Four Waves of TCP Protocol"
Handshake, 4 wave hands"
"Computer network communication protocol diagram (Chinese Collector's Edition)"
"What is the maximum size of a packet in UDP? "Z5z
" P2P technology detailed (1): NAT detailed-detailed principles, introduction to P2P"
"P2P technology detailed (2): P2P NAT traversal (hole punching) program detailed"
"P2P technology detailed (3): Detailed explanation of STUN, TURN, ICE of P2P technology"
"Easy to understand: Quickly understand the principle of NAT penetration in P2P technology"
"High-performance network programming (1): How many concurrent TCP connections can a single server have"
"High-performance network programming (2): The last 10 years, the famous C10K concurrent connection problem"
"High-performance network programming (3): In the next 10 years, it is time to consider the C10M concurrency problem"
"High-performance network programming (4): Theoretical exploration of high-performance network applications from C10K to C10M"
"High-performance network programming (5): An article to understand the I/O model in high-performance network programming"
"High-performance network programming (6): An article to understand the thread model in high-performance network programming"
"Unknown network programming (1): Analysis of the incurable diseases in TCP protocol (Part 1)"
"Unknown network programming (2): Analysis of the intractable diseases in the TCP protocol (Part 2)"
"Unknown network programming (3): Why TIME_WAIT, CLOSE_WAIT when closing the TCP connection"
"Unknown network programming (4): in-depth study Analyze the abnormal shutdown of TCP"
"Unknown network programming (5): UDP connectivity and load balancing"
"Unknown network programming (6): Deeply understand the UDP protocol and use it well"
"No Known network programming (7): How to make the unreliable UDP reliable? "Z5z
"Unknown Network Programming (8): Depth HTTP Decryption from the Data Transmission Layer"
"Unknown Network Programming (9): Combining Theory with Practice, Comprehensive and In-depth Understanding of DNS"
"Technical Literacy: New Generation UDP-based low-latency network transport layer protocol-Detailed Explanation of QUIC"
"Make the Internet Faster: A New Generation of QUIC Protocol in Tencent's Technical Practice Sharing"
"Summary of optimization methods for short connection of modern mobile network: request speed, weak Network adaptation, security assurance"
"Talk about the long connection of network programming in iOS"
"Mobile IM developers must read (1): easy to understand, understand the "weak" and "slow" of mobile networks"
"Mobile IM developers must read (2): The most comprehensive mobile weak network optimization method in history"
"IPv6 technology details: basic concepts, application status, technical practice (part 1)"
"IPv6 technology details: basic concepts, Application Status, Technical Practice (Part 2)"
"From HTTP/0.9 to HTTP/2: Understanding the Historical Evolution of HTTP Protocol in One ArticleAnd Design Ideas"
"Introduction to Brain Disabled Network Programming (1): Follow the animation to learn TCP three-way handshake and four waves"
"Brain Disabled Network Programming Introduction (2): What are we reading and writing when we read and write Socket ? "Z5z
"Brain-disabled network programming introduction (3): Some knowledge of HTTP protocol"
"Brain-disabled network programming (4): Quickly understand HTTP/2 server push"
"Brain-disabled type Introduction to Network Programming (5): What is the Ping command that is used every day? "Z5z
"Brain Disabled Network Programming Introduction (6): What is the public network IP and internal network IP? What the hell is NAT? "Z5z
"Take the network access layer design of the online game server as an example to understand the technical challenges of real-time communication"
"Towards a higher level: the network foundation that outstanding Android programmers must know"
"A comprehensive understanding of mobile DNS domain name hijacking Miscellaneous diseases: technical principles, root causes, solutions, etc."
"Meitu App’s mobile DNS optimization practice: HTTPS request time-consuming is reduced by nearly half"
"Android programmers must know the network communication transport layer protocol ——UDP and TCP"
"Introduction to zero-based communication technology for IM developers (1): A century of development history of communication exchange technology (Part 1)"
"Introduction to zero-based communication technology for IM developers (2): Communication exchange technology A Hundred Years of Development History (Part 2)"
"Introduction to Zero-Basic Communication Technology for IM Developers (3): A Hundred Years of Changes in Chinese Communication Methods"
"Introduction to Zero-Basic Communication Technology for IM Developers (4): The Evolution of Mobile Phones, in History The most complete mobile terminal development history"
"IM developer's introduction to zero-based communication technology (5): 1G to 5G, 30 years of mobile communication technology evolution history"
"IM developer's introduction to zero-based communication technology (6): mobile Terminal Connector-"Base Station" Technology"
"Introduction to Zero-Basic Communication Technology for IM Developers (7): Maxima for Mobile Terminals-"Electromagnetic Waves""
"Introduction to Zero-Basic Communication Technology for IM Developers (8) : Zero foundation, the strongest "antenna" principle literacy in history"
"Introduction to zero-based communication technology for IM developers (9): The backbone of wireless communication network-"core network""
"Zero-based communication technology for IM developers Introduction (10): Zero Basics, the Strongest 5G Technology Literacy in History"
"Introduction to Zero Basic Communication Technology for IM Developers (11): Why is the WiFi signal poor? Understand in one sentence! "Z5z
" Introduction to Zero-Basic Communication Technology for IM Developers (12): Internet stuck? Internet disconected? Understand in one sentence! "Z5z
" Introduction to Zero-Basic Communication Technology for IM Developers (13): Why is the mobile phone signal poor? Understand in one sentence! "Z5z
"Introduction to Zero-Basic Communication Technology for IM Developers (14): How difficult is it to surf the Internet on high-speed rail? Understand in one sentence! "Z5z
"Introduction to zero-based communication technology for IM developers (15): Understanding positioning technology, one is enough"
"Baidu APP mobile terminal network deep optimization practice sharing (1): DNS optimization articles"
"Baidu APP mobile Practical Sharing of Deep-end Network Optimization (2): Network Connection Optimization"
"Practical Sharing of Deep-Optimization of Baidu APP Mobile Network (3): Mobile-end Weak Network Optimization"
"Sharing of Technology Master Chen Shuo: From the shallower to the deeper , Network programming learning experience dry goods summary"
"May mess up your interview: Do you know how many HTTP requests can be initiated on a TCP connection? "Z5z
"Knowing Technology Sharing: Knowing the Practice of Ten-Million-Level Concurrent High-Performance Long Connection Gateway Technology"
>> More similar articles......
(This article is published simultaneously at: http://www.52im.net/thread -2816-1-1.html)