The new HTTP/2 protocol promises significantly faster Web app performance as a simple bolt onto the application server. Development shops should proceed cautiously if they have adopted manual tweaks to improve website performance over the older HTTP/1.1 protocol.
Optimizations such as spriting, inlining, concatenation and sharding will not benefit from HTTP/2, and may hinder performance on the new protocol. As a result, developers should consider load testing as a key part of their transition strategy, said Ragnar Lonn, founder and CEO of Load Impact, a Sweden-based testing service, at the Fluent development conference. The company recently released the HTTP/1 vs. HTTP/2 tool to help automate this analysis for different websites, apps and APIs.
At the same time, organizations need to develop a strategy for improving performance for HTTP/2, while maintaining backward compatibility with HTTP/1. All the newer browsers support HTTP/2, and Firefox turns it on by default. However, many users have not upgraded to support the newer protocol. Only 24% of Firefox traffic uses the newer protocol.
Focus on latency
Lonn said it is important to think through the importance of latency in order to assess the effect of the new protocol on application performance. Latency is influenced by user connection speed, application design patterns, cache considerations and other factors.
The user connection speed is one factor in latency, since it limits the amount of data that can be sent at once, as well as the physical round-trip time of packets. Another factor is round-trip time, which is more linearly correlated with page load time. These effects are further influenced by the growth in the size of modern websites and the number of objects sent to browsers.
Obviation older optimizations
A number of techniques addressing network latency have been implemented to work with HTTP/1.1, including pipelining, connection reuse, improved caching and range requests. On top of these, developers have created a number of optimizations in the way page content is delivered. Spriting converts common images into code delivered as part of the page. Inlining is the process of embedding scripts, styles and images into the HTML, so they can be served as one big page. Sharding involves tricking a browser into retrieving content from a single site from different servers in order to open up more HTTP connections.
The HTTP protocol obviates the need for these optimizations, Lonn said. It is less sensitive to network delay. It addresses head-of-line blocking problems that result when an application stalls waiting for important lost packets. It also performs well regardless of the number of TCP connections used through the use of HTTP/2 multiplexing. Multiplexing takes advantage of a concept called streams, which can be prioritized, cancelled and managed with individual flow control.
Quantify the performance effect
Lonn analyzed the relative performance improvement by creating a mock-up of the Amazon website. This made it easier to tease apart the sites performance over HTTP/1.1 and HTTP/2 by adding different sources of latency to the network. The site mock-up consisted of about 7 MB of data and 240 resources. He found a 50% to 70% load time change between the two protocols, depending on network latency.
The Load Impact code for testing out different components of applications is available on GitHub and via a Web application. Lonn said more data is still required to assess the effect of the new protocol on different kinds of applications and APIs. Ideally, organizations should adopt a strategy of assessing variations in code implementation across the two protocols.
A key factor in this strategy may lie in finding tools that help automate application optimization for the separate protocols. Otherwise, organizations may have to spend considerable effort to manage different code bases for the separate protocols.
What practices and/or tools has your shop adopted to support the transition to HTTP/2 smoothly? Let us know.
What does HTTP/2 mean for security?
Can Web performance testing improve your system?
AWS app performance management tools