Looking back over the last 25 years or so, it may feel like we have been on an inevitable and logical path from FriendsReunited to Facebook. But hindsight is a wonderful thing. Who said that? Well we could Google it, and if we did, we would open up a browser, on whatever device is to hand, and start typing, speaking or tapping away until we found something worth a look. All of that activity is based on the brilliantly simple HTTP protocol, which was a major factor in its widespread adoption, but is now alas starting to show signs of its age.
What is HTTP/2?
Based on Google’s SPDY, HTTP/2 is designed to improve performance over HTTP 1.1 by:
- Using a binary format to encode and send data. In a previous article, we discussed how data can be compressed using algorithms or rules based on an understanding of text. However, the new standard can be even more efficient as the context is also understood. Think about the difference between the size of an initial message you may send to someone and then the size of each subsequent message once you both know what you are talking about. Get it? Thought so.
- Using multiplexing, which is a way of transferring the various bits of information, in the most efficient and timely way possible over a single stream on a single connection.
- Streaming prioritisation for the more important information, because there’s nothing more annoying than standing behind a queue of pensioners at the post office during your lunch break.
- Creating a framework for flow control. A receiver should only get as much information as they can handle, otherwise they will be over loaded. This was tricky to implement previously as information may have been transferred over multiple connections. Now that all communication will be over a single connection a mechanism has been put in place to determine the rate at which information should be sent.
- Using Server Push – which anticipates what you might want next and gives it to you before you ask.
Crucially, the protocol is backward compatible, meaning that if one side isn’t HTTP/2 compatible, HTTP 1.1 can seamlessly be used instead. So all’s fine, right? Well mostly yes…
Browser and Web Server Users
The good news is that leading browsers (Chrome, Firefox, Edge) and web servers (IIS, Apache, nginx) already support the standard, so the chances are you will be able to make the change without software upgrades. However, before switching over you should bear in mind all of the optimisations put in place for HTTP 1.1 traffic may now start to be a hindrance.
You may deploy resources to multiple sites to avoid parallel request bottlenecks, also known as domain sharding, or you may have merged resource files to reduce the number of round trips. These actions are now not necessary and could start to impede performance.
Alas, some of those wise changes made over the last few years may need to be backed out. However, at least you can use the opportunity to see how to make use of new features such as Server Push.
Web Services/System API’s
Whilst much of the focus in HTTP/2 understandably goes on improving web page performance, web-based services should also be given careful thought.
A deployed service may now be in a position to be handled via HTTP/2, but the protocol version that is used will depend on the client used. There should be substantial gains in transfer times for services that rely on small but regular amounts of information transfer. However, reducing the amount of information that needs to be sent means increasing the processing required at each end. This is something that should be tested.
Planning for the Switch
Whatever sites, applications, content and services you are supporting or consuming, change is coming so plan for it.
When drawing up your plan make sure you:
- Identify the client base and establish capability for using HTTP/2
- Determine how you can make the most of the new features
- Find out which of your clients are likely to be left behind? Can you help them, or at least make them aware of how performance can be improved?
- When service consuming services, make sure you have reviewed your client code to see where there is scope for upgrade. A list of HTTP/2 ready technologies is available at: https://github.com/http2/http2-spec/wiki/Implementations
- Performance test the different approaches and outcomes
Howard Osborne, Managing Consultant
Prolifics Testing has wide-ranging experience in performance testing, through our collaboration on client projects. We help organisations to obtain greater efficiencies and ROI, through our specialist expertise and understanding of the best performance testing tools. Should you require guidance on enhancing performance testing at your organisation, please contact us for more information.