Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why HTTP/2 is slower than plain HTTPS?

I'm evaluating what I can get for my web site from HTTP2 in terms of performance and getting weird result - the site in Europe is loaded from US:

  • with HTTP/2 - in 6-7 seconds
  • with plain HTTPS - in 5-6 seconds (roughly 1 second quicker)

I've capture screenshots from Network monitor of Chrome and it looks like with HTTP/2 most of the resources are loaded one after another rather than in parallel like in case of plain SSL.

For testing I'm using my web application covered by Apache 2.4.17 (Win32) as proxy (to apply support for SSL & HTTP/2 protocols). Client browser is Chrome 46.0.2490.86 on Windows 7.

Captured network requests are below. Short summary: 1. Fist one - is HTML page 2. Next group - 6 requests - resources declared directly in HTML 3. The rest - resources added dynamically via script ('script' and 'link/css' tags in document/head).

Left side of the picture is HTTP/2, right side - same staff via plain SSL (http2_module is turned off).

enter image description here


Update: I've tested "something else" what supports HTTP/2 as reverse proxy. It is nginx 1.9.7.1 Kitty from http://nginx-win.ecsds.eu - fork of original nginx 'for windows'. HTTP/2 in original nginx is only available in commercial version, therefore I could not try it. And it looks like there are no other servers implementation of HTTP/2 + reverse proxy available for windows, or I just couldn't find them (list here and here).

The result I've got with Kitty is even more misleading - there is no 'sequential load' of resources like in Apache, but transfer rate is twice slower over HTTP/2 than over plain SSL. Final result is - HTTP/2 is significantly slower than plain SSL. Below are all of them side by side.

Out of all this i can only assume that performance strongly depends on implementation and currently available implementation perform weirdly to make any consistent conclusion about HTTP/2.

enter image description here

like image 734
Xtra Coder Avatar asked Nov 11 '15 19:11

Xtra Coder


People also ask

Why is HTTPS faster than HTTP?

HTTP vs HTTPS Performance. In general, HTTP is faster than HTTPS due to its simplicity. In HTTPS, we have an additional step of SSL handshake unlike in HTTP. This additional step slightly delays the page load speed of the website.

Is HTTP2 faster than HTTP?

In particular, HTTP/2 is much faster and more efficient than HTTP/1.1. One of the ways in which HTTP/2 is faster is in how it prioritizes content during the loading process.

Why HTTP2 is not widely used?

First, because they received requests in large batches instead of smaller, more spread-out batches. And secondly, because with HTTP/2, the requests were all sent together—instead of staggered like they were with HTTP/1.1—so their start times were closer together, which meant they were all likely to time out.

Is HTTP2 the same as HTTPS?

HTTPS secures the connection between a visitor's browser and the web server, ensuring data is encrypted and protected from intermediary actions. HTTP/2 allows for multiplexing (requesting multiple files at the same time). This significantly improves both site performance and server efficiency.


1 Answers

So, finally my decision is - there is nothing wrong with HTTP/2 itself, there is something wrong with implementations currently available.

  • Apache HTTPD 2.4.17 / Win32 - has some weird 'sequential load' effect
  • nginx Kitty - provides weirdly slow transfer rate
  • official freeware nginx does not have http2 module built in

but

  • custom-built nginx for windows from kevinworthington.com
  • Apache HTTPD 2.4.17 / linux

both show expected performance. Here is the screenshot for same test performed in 'the question', but with Apache reverse proxy hosted on linux computer of another guy here.

enter image description here

like image 54
Xtra Coder Avatar answered Sep 18 '22 16:09

Xtra Coder