HTTPS,SPDY,HTTP/2 Performance Comparison

Source: Internet
Author: User

zhanhailiang 日期:2015-01-24

Original: A simple performance Comparison of HTTPS, SPDY and HTTP/2

First of all, congratulations Firefox 35 is the first browser that supports the HTTP/2 protocol by default. However, since the HTTP/2 protocol is not fully determined, Firefox actually supports the HTTP/2 Draft 14 version (of course, the final agreement does not make a big change). Since Google already supports the HTTP/2 Draft 14 version and the SPDY protocol on the server side, we can compare HTTPS,SPDY,HTTP/2 performance differences by visiting Google servers.

Note: You need to update HttpWatch to the latest version to support the HTTP/2 protocol, the new version of the HttpWatch Add Protocol column to show the requested protocol information, such as:

Performance comparison

The following performance test will be based on Firefox+httpwatch, access to Google's Hong Kong home page via the HTTPS,SPDY/3.1,HTTP/2 protocol to get their own pages load test data. Each visit will be tested via the Firefox about:config page Setup with only a specified protocol, such as:

Note: The local cache needs to be emptied for each test.

Test 1 The size comparison of the request header and the response header

As you know, the vast majority of sites will open gzip to compress the text content of the response. Unfortunately, the http/1.1 protocol itself does not support the compression of the request Header/response header. Spdy and HTTP/2 use different compression algorithms to solve this flaw. Where Spdy uses the DEFLATE algorithm to compress the request header, and HTTP/2 uses the hpack algorithm to compress the request header.

As compared to the data, where "Sent" represents the request header size, "Received" indicates the response header size:

Victor: HTTP/2

Test 2: Size comparison of response messages (Response message)

The server-side response message includes the response header and the encoded response content. As compared to the data, HTTP/2 can compress the response header to a minimum, but does not guarantee that the overall response message will be compressed to a minimum:

First, request a picture resource (you can see that HTTP/2 has the best compression rate):

Second, request a text resource (you can see that Spdy has the best compression rate):

The reason the resource is larger when using HTTP/2 to request a text resource is because the HTTP/2 compresses the extra bytes that are caused by the HTTP/2 data frame. HTTP/2 reasons for using padding bytes:

Padding can used to obscure the exact size of frame content, and are provided to mitigate specific attacks within HTTP. For example, attacks where compressed content includes both attacker-controlled plaintext and secret data (see for example , BREACH).

The fact that the fill behavior does not appear in the image resource is because the image resource itself is a compressed format, guaranteeing that no extra text will be inserted by the attacker.

Victor: SPDY

Test 3:tcp number of connections vs. SSL handshake

By adjusting the number of concurrent requests under each domain name from 2 to 6, the browser has gained a significant performance boost. This is achieved by consuming more TCP connections and SSL handshakes for larger concurrent downloads, while increased concurrency reduces blocking requests and makes more efficient use of bandwidth.

SPDY,HTTP/2 uses multiplexing to support TCP connections and the reuse of SSL connections so that multiple requests can be used on a single connection, reducing the consumption of TCP connections, such as HttpWatch Add connect and SSL handshake columns to show related data:

It can be seen that SPDY,HTTP/2 only requests under different domain names to create a new TCP connection/ssl handshake, while HTTPS requests in a single domain name also require the creation of multiple TCP connection/ssl handshakes.

Winner: SPDY & HTTP/2

Test 4: Page load time comparison

Victor: HTTP/2

Note: In this case, the page load time HTTPS is the slowest, mainly due to

    1. Missing request Header/response header compression;
    2. Additional TCP connection/ssl handshake is required;

In more complex scenarios, the SDPY,HTTP/2 advantage is more pronounced.

Conclusion

HTTP/2 has a great performance advantage over https,sdpy, but filling in response messages is a point of concern (guaranteed performance and security) that needs to be balanced.

Read more
    1. Request/Response headers in the SPDY3.1
    2. Hypertext Transfer Protocol (HTTP) 2 in bilingual version

HTTPS,SPDY,HTTP/2 Performance Comparison

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.