HTTP/2: the Pros, the Cons, and What You Need to Know
HTTP/2: Revolutionary improvement in web page loading speed
HTTP/2 is a major upgrade to HTTP/1.1, designed to solve performance issues and reduce website loading time. It achieves this through features such as multiplexed streams, server push, header compression and binary format.
Multiplexing allows multiple requests and responses to be sent simultaneously over a single TCP connection, reducing congestion and increasing speed. Server push actively sends resources to the browser's cache, thereby improving performance. Header compression reduces data retrieval time and bandwidth usage. The binary format is easier to process, thus reducing server workload and page loading time.
Developers will no longer need to use solutions such as image Sprite, inline and file connection to reduce the number of requests on web pages. However, most HTTP/2-enabled browsers require HTTPS encryption, which may pose a challenge to some users considering switching.
Although HTTP/2 has many advantages, it has also been criticized for its over-focus on bandwidth and neglecting privacy issues. Some believe that HTTP/2 may not last long due to the rapid development of technology and the need for more flexible protocols to address changing technological challenges.
How HTTP/1.1 works
When you access a web page, the browser obtains the page by requesting all resources of the page from the web server. Since the birth of the Web, this has been done primarily through HTTP/1.1.
As time goes by, technology continues to evolve, websites become more and more complex and resource-intensive, the HTTP/1.1 protocol is under increasing pressure and requires many workarounds to deal with performance issues.
Today's web pages usually contain a lot of resources, such as images, text, fonts, etc., which makes them much heavier than those in the 90s and even the 2000s. As a result, they load longer, so web designers and developers come up with clever workarounds to solve this problem. However, it is obvious that the HTTP protocol itself needs to be updated.
How HTTP/2 works
Your browser will still send requests to the server and receive responses to the required resources so that the webpage can display properly, but the nuances between the two will change. HTTP/2 introduces new features such as multiplexed streams, server push, header compression and binary formats, which we will explore in turn.
-
Multiplexing stream: Multiplexing passes these resources into smaller parts, passes them through a connection, and then reassembles the resources once they reach their final destination (browser) , thereby eliminating congestion problems caused by many connection delivery resources such as text, fonts, and pictures.
-
Server push: Server push represents a more efficient way to deliver resources to the browser. In an HTTP/1 environment, the HTML page is sent to the browser, which must parse it and determine the resources it may need, and then request those resources from the server. HTTP/2 is more proactive in this regard, sending resources that the browser may need without requests. These resources go into the browser's cache and are immediately available when needed, which is an advantage for performance.
-
Header Compression: In HTTP/1, each sent request is attached with a small portion of additional data - the HTTP header - that describes how the browser or server behaves. On average, a browser can make about 6 connections at a time, but considering that the number of connections required to load a typical web page may be as high as 100, this still requires retrieving a large amount of data, which takes time and bandwidth. When an HTTP/2 connection is established, all headers are packaged into a compressed block and sent as a whole. It transmits faster, and after the transmission is completed, the header block is decoded.
-
Binary format instead of text format: Text format has some extra overhead that needs improvement, while binary format does not require any parsing. It's also more compact. The extra work of the server means extra time to wait for the webpage to load. This is why the binary format is easier to handle and is a reasonable improvement.
What different things can developers do now
Developers will no longer need to process image Sprite, inline and file connections, because there is no need to reduce the number of requests on the web page. Basically, this will be the biggest change in their daily work. However, there is more to be said about internal changes that may affect their work in some way.
Things to note
Although the HTTP/2 specification itself is not mandatory, most browsers that support HTTP/2 require HTTPS encryption. This means that if your HTTP/2 site is not provided via an encrypted connection, visitors will either have to find another client to access your site or miss it.
While there are now some trends that drive sites to deliver via HTTPS, browsers have criticized this requirement and will undoubtedly be a stumbling block for some people considering switching to HTTP/2. (For more tips on what HTTPS is and how to implement it, read SitePoint's recent introduction to HTTPS.)
For the public, the transition of the network will be seamless. Modifications and upgrades required to work in the new protocol version will be done in the server and in the browser. The server will be updated over time, ultimately supporting both protocols. Browsers that support the new protocol will automatically switch to HTTP/2. At the same time, old browsers will not be able to understand it. As a developer, you need to know if both your browser and the server you are using support for HTTP/2 to ensure that the connection will be upgraded to HTTP/2.
Some controversies
While many are excited about HTTP/2, others, like Poul-Henning Kamp, are not that impressed. Kamp thinks HTTP/2 is "really just a grand name for HTTP/1.2" and thinks that if it does take off, it will most likely not last long.
In his opinion, the new protocol does not solve the actual problem, but focuses too much on bandwidth. A better focus, he suggests, should be to cancel the concept of cookies and replace it with a session/identity tool. This will improve privacy in a world with increasing security risks to some extent. And HTTP/2, Kamp believes, does not significantly improve privacy.
View the difference
This Akamai demonstration illustrates how resources are loaded concurrently in both protocol versions. The first image is loaded via HTTP/1 and six concurrent connections (if you are using Google Chrome), while the second image is loaded via HTTP/2 as a whole, all parts are loaded at the same time.
If you want to have a deeper understanding of how data is loading differently in protocol connections, check out this golang.org example. It allows you to try different delay settings so that you can see how data is loaded concurrently on devices of different capacity. The longer the latency, the more obvious the HTTP/2 wins in terms of performance.
Bottom line
HTTP/2 will be a smooth transition for ordinary users, and for those working in the network, there are some choices to make.
Generally speaking, the website will be safer and load faster. The agreement has not brought about any fundamental change, probably because it is more technically and politically harder to achieve. That's why HTTP/2 may not serve us for that long.
The world of technology is growing faster every year, so in a few years we may need something else. My personal hope is that the next protocol will be more flexible and braver in dealing with changing technological challenges.
(FAQs)FAQs about HTTP/2 (The FAQs section is omitted here because the content is highly overlapping with the previously covered content, so that duplication is avoided.)
The above is the detailed content of HTTP/2: the Pros, the Cons, and What You Need to Know. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The rise of Chinese women's tech power in the field of AI: The story behind Honor's collaboration with DeepSeek women's contribution to the field of technology is becoming increasingly significant. Data from the Ministry of Science and Technology of China shows that the number of female science and technology workers is huge and shows unique social value sensitivity in the development of AI algorithms. This article will focus on Honor mobile phones and explore the strength of the female team behind it being the first to connect to the DeepSeek big model, showing how they can promote technological progress and reshape the value coordinate system of technological development. On February 8, 2024, Honor officially launched the DeepSeek-R1 full-blood version big model, becoming the first manufacturer in the Android camp to connect to DeepSeek, arousing enthusiastic response from users. Behind this success, female team members are making product decisions, technical breakthroughs and users

DeepSeek released a technical article on Zhihu, introducing its DeepSeek-V3/R1 inference system in detail, and disclosed key financial data for the first time, which attracted industry attention. The article shows that the system's daily cost profit margin is as high as 545%, setting a new high in global AI big model profit. DeepSeek's low-cost strategy gives it an advantage in market competition. The cost of its model training is only 1%-5% of similar products, and the cost of V3 model training is only US$5.576 million, far lower than that of its competitors. Meanwhile, R1's API pricing is only 1/7 to 1/2 of OpenAIo3-mini. These data prove the commercial feasibility of the DeepSeek technology route and also establish the efficient profitability of AI models.

Website construction is just the first step: the importance of SEO and backlinks Building a website is just the first step to converting it into a valuable marketing asset. You need to do SEO optimization to improve the visibility of your website in search engines and attract potential customers. Backlinks are the key to improving your website rankings, and it shows Google and other search engines the authority and credibility of your website. Not all backlinks are beneficial: Identify and avoid harmful links Not all backlinks are beneficial. Harmful links can harm your ranking. Excellent free backlink checking tool monitors the source of links to your website and reminds you of harmful links. In addition, you can also analyze your competitors’ link strategies and learn from them. Free backlink checking tool: Your SEO intelligence officer

Midea will soon release its first air conditioner equipped with a DeepSeek big model - Midea fresh and clean air machine T6. The press conference is scheduled to be held at 1:30 pm on March 1. This air conditioner is equipped with an advanced air intelligent driving system, which can intelligently adjust parameters such as temperature, humidity and wind speed according to the environment. More importantly, it integrates the DeepSeek big model and supports more than 400,000 AI voice commands. Midea's move has caused heated discussions in the industry, and is particularly concerned about the significance of combining white goods and large models. Unlike the simple temperature settings of traditional air conditioners, Midea fresh and clean air machine T6 can understand more complex and vague instructions and intelligently adjust humidity according to the home environment, significantly improving the user experience.

DeepSeek-R1 empowers Baidu Library and Netdisk: The perfect integration of deep thinking and action has quickly integrated into many platforms in just one month. With its bold strategic layout, Baidu integrates DeepSeek as a third-party model partner and integrates it into its ecosystem, which marks a major progress in its "big model search" ecological strategy. Baidu Search and Wenxin Intelligent Intelligent Platform are the first to connect to the deep search functions of DeepSeek and Wenxin big models, providing users with a free AI search experience. At the same time, the classic slogan of "You will know when you go to Baidu", and the new version of Baidu APP also integrates the capabilities of Wenxin's big model and DeepSeek, launching "AI search" and "wide network information refinement"

This Go-based network vulnerability scanner efficiently identifies potential security weaknesses. It leverages Go's concurrency features for speed and includes service detection and vulnerability matching. Let's explore its capabilities and ethical

AI Prompt Engineering for Code Generation: A Developer's Guide The landscape of code development is poised for a significant shift. Mastering Large Language Models (LLMs) and prompt engineering will be crucial for developers in the coming years. Th
