You Lian HTTP2 I still don't understand , Someone started talking about HTTP3 了 , It's so hot . but HTTP3 There's also a reason to be concerned : It's fast .
1. Long ago
Before talking about the future , Let's talk about reality first .
You know HTTP Do you ? This is defined in 1991 The agreement was made to manage Web Of . Its full name is Hypertext Transfer Protocol , So you can get resources from the web , Web data from Web The server transfers it to your browser . It's based on lower level protocols ——TCP, Here's the point —— And it's stateless . This means that each request is completely independent . Each of the GIF Pictures are all independent on the Internet , This is for these GIF The picture itself is a good thing . But for us , Such a system is a bit fragmented .
The problem is that each request only looks for one file at a time . Create an expensive one each time TCP Connect . Imagine , If you have 10,000 A little trick , What a heavy burden it would be .
I know a lot of people like the pictures I made in my last article , So in order to better explain the protocol mechanism of the Internet , Here I'll make another picture .
Although browsers can make six different requests at the same time , however HTTP Still very slow , And it takes a lot of TCP Connect . in addition , We developers don't usually care about this . We like to stuff pages with all kinds of rubbish . For example, huge jQuery library , contain 300 A useless one CSS Style sheets , The end is a transparent 8 Trillion PNG chart .
When Google found out that we were dumping rubbish all over the Internet , And they started a project called SPDY Something. . What is the purpose ? Speed up the Internet, of course .
SPDY It's a norm , It is recommended to continue to use HTTP, But change some rules . By compressing the header 、 Prioritizing and multiplexing requests , It will put all of TCP The request and the connection become separate !
say concretely , When you read HTML when , The browser will see everything you want to ask in the page . then , It can get everything at once , In this way, you can avoid getting one file at a time .
HTTP2 The first draft of is based on SPDY.HTTP2 Soon it was widely adopted , And then everything on the Internet got much faster . today , On the Internet 42.7% Content usage HTTP2.
2. About HTTP3
HTTP2 In order to HTTP Based on and changing some rules of the product .HTTP3 So it is with . let me put it another way , After explaining the status quo , I can easily explain what the future looks like .
Google is a geek organization , They will never stop .SPDY Evolved into HTTP2 after , They think it's still not fast enough . therefore , They began to talk about QUIC This project . This is the second project that Google has developed and will be HTTP The formal upgrade technology of the agreement . that , What's special about this Agreement ?
HTTP3 The main improvement is in the transport layer . The transport layer won't have the heavy stuff I mentioned earlier TCP Connected to . Now? , Everything will go UDP.
By the way ,QUIC It means “ Fast UDP Internet Connect ”. This change in the protocol will significantly speed up connection establishment and data transfer . However , although UDP It must be faster 、 It's simpler , But it doesn't have TCP Reliability and error handling capabilities of .
TCP You have to go back and forth many times , To make connections in a square and stable way .UDP Don't worry so much , And it does run fast , The cost is the risk of stability degradation and packet loss . however ,UDP Can greatly reduce the delay in the request . The latency of repeated connections to the same server is almost zero , Because there's no need to go back and forth to establish a connection .
HTTP3 yes HTTP2 Reuse and compression of , The agreement is from TCP Change to UDP. then , Those people at Google have added layers they've made to the agreement , To ensure stability 、 Packet receiving sequence and security .
therefore ,HTTP3 In maintaining QUIC Use stability at the same time UDP To achieve high speed , At the same time, it won't sacrifice TLS The security of . Yes , stay QUIC in TLS1.3, You can use it to launch elegant SSL. The underlying mechanism of these layers is as follows :
2018 year ,QUIC Evolved into HTTP3. Internet Engineering Task Force (Internet Engineerring Task Force) The group of people who made the internet protocol agreed to the proposal . That's good news , Because for us impatient people , The Internet is never fast enough .
3. Conclusion
HTTP3 Represents a glamorous future , its HTTP The underlying potential has been brought to the best of Google's geeks . At the time of writing , Only 4.6% Of the Internet content in use HTTP3, But that number is likely to grow a lot in the next few years . This article only talks about the knowledge in this respect , But if you want to know more , There are many articles on the Internet for your reference .
Link to the original text :http://suo.im/5yhSj1