- vừa được xem lúc

HTTP/2: How It’s Faster Than HTTP/1.1

0 0 19

Người đăng: Từ Phương Danh

Theo Viblo Asia

HTTP/1.1 has been the workhorse of the internet for over a decade, but its limitations have become more and more apparent as web traffic has exploded in recent years. To address these limitations, the HTTP/2 protocol was introduced in 2015. In this article, we’ll explore the key ways in which HTTP/2 is faster than HTTP/1.1.

1. Multiplexing

One of the biggest limitations of HTTP/1.1 is that it only allows a single request-response cycle at a time over a single TCP connection. This means that if a webpage has many resources, such as images, scripts, and stylesheets, each of these resources must be requested and delivered one at a time, in a serial fashion.

HTTP/2, on the other hand, supports multiplexing, which means that multiple requests and responses can be sent over a single TCP connection at the same time. This allows resources to be requested and delivered in parallel, significantly reducing page load times.

2. Server Push

HTTP/1.1 requires the client to request each resource individually. This means that the server has no way of knowing which resources the client will need in the future, and must wait for each request before sending the corresponding resource.

HTTP/2 introduces a new feature called Server Push, which allows the server to send resources to the client before they are requested. This can significantly reduce the latency of subsequent requests, since the required resources are already in the client’s cache.

3. Header Compression

HTTP/1.1 headers are sent with each request and response, and can contain a lot of redundant information. This can result in a lot of unnecessary data being sent over the network, slowing down page load times.

HTTP/2 uses a new compression algorithm called HPACK to compress headers before they are sent over the network. This reduces the amount of data that needs to be transmitted, improving performance and reducing bandwidth usage.

4. Binary Protocol

HTTP/1.1 uses a text-based protocol, which is easy to read and understand, but can be inefficient for computers to parse. This is because text-based protocols require more processing to convert the text into machine-readable code.

HTTP/2, on the other hand, uses a binary protocol, which is designed to be more efficient for computers to parse. This reduces the processing time required for each request, resulting in faster page load times.

5. Prioritization

In HTTP/1.1, all requests have the same priority, which can lead to slower page load times if some resources are more important than others.

HTTP/2 allows requests to be prioritized based on their importance, allowing critical resources to be delivered more quickly. This can significantly improve page load times, especially on complex webpages.

In conclusion, HTTP/2 is faster than HTTP/1.1 due to its support for multiplexing, server push, header compression, binary protocol, and prioritization. While HTTP/1.1 served the internet well for many years, its limitations have become more and more apparent as web traffic has increased. By addressing these limitations, HTTP/2 is poised to become the new standard for web communication.

Bình luận

Bài viết tương tự

- vừa được xem lúc

Tạo SSL Certificate Authority cho HTTPS trên local

Trên đây cũng có khá nhiều bài viết làm sao để tạo self-signed SSL cho localhost để có thể test thử HTTPS. Nhưng những cách đó đều có một nhược điểm là khi vào trang sẽ có cảnh báo NET::ERR_CERT_AUTHO

0 0 44

- vừa được xem lúc

Exploring gRPC: The High-Performance Alternative to REST APIs

gRPC is an open-source framework that is widely used for building high-performance APIs. It uses the Protocol Buffer as its data format for serialization, which makes it faster and more efficient than

0 0 20

- vừa được xem lúc

Sự phát triển của HTTP

Chào các bạn . Giới thiệu về HTTP.

0 0 33

- vừa được xem lúc

Mít Đặc và Biết Tuốt nói về tốc độ mạng và sự tiến hóa của HTTP từ HTTP1, HTTP2, HTTP3

Mít đặc: Tôi không hiểu tại sao, cứ hết nâng cấp từ http1 lên http2 rồi http3 làm gì, cấu hình chết mệt mà chả biết nó có tác dụng gì không. Mít đặc: Đương nhiên là không biết, nhưng nó có liên quan g

0 0 11