As of 2012, the HTTP2 protocol was released into the wild. The HTTP2 protocol has a few big advancements over the HTTP 1.1 protocol. The original HTTP 1.1 protocol is starting to get stretched then as web pages grow and demand more resources. So, if you haven’t yet, it may be time to update to HTTP2. Before you make that final decision and push, though, let’s go over a few of the pros and cons of updating your web server to support HTTP2.
- Reduced TCP connection load: Every time a browser requests a website from a web server it has to establish multiple connections for different requests. That’s because the HTTP 1.1 spec requires a different TCP connection for each request. A large website could easily flood a web server because of the number of requests that need to be made. HTTP2 only requires one TCP connection for multiple requests which saves bandwidth.
- Header compression: HTTP 1.1 lets webserver compress the headers of HTTP requests saving even more bandwidth. The HTTP 1.1 protocol only allows the body of a request to be encrypted, but the HTTP2 protocol goes further by allowing the entire packet to be compressed.
- Server push: The HTTP2 protocol allow the server to anticipate needed assets for a website and push them ahead of time before the client browser requests those assets. This saves processing time and bandwidth. Because the server can use one TCP connection to send and receive multiple requests, the web server can use this connection to push anticipated data that hasn’t been requested yet.
- Potentially wasted bandwidth: Because the HTTP 2 protocol allows servers to push anticipated assets, you might possibly be wasting bandwidth. Just because a request to load a web page might need an asset, it doesn’t mean it will. You could be sending data that isn’t needed and thus wasting bandwidth.
- HTTPS: There’s been a huge push to use SSL for website connections in the past couple of years. So much so that Google stated it would start to downgrade sites in search results that don’t use it. Though the HTTP2 protocol doesn’t require HTTPS, just about any browser that supports HTTP2 also requires HTTPS. Upgrading to HTTP2, for better or worse, means you now have to support HTTPS.
- Increased latency: Because you’re all but forced to use HTTPS going forward, you will experience increased latency times. A secure connection imposes more over-head. It’s the nature of how it works. Keep in mind, increased latency may not actually mean slower loading speeds because, though latency increases, more data is being sent at one time since the HTTP2 protocol allows for a single, multiplexed connection instead of requiring many connections. Basically, you’re going to have to do some more testing on your end to measure the impact of your individual website.