Enter HTTP/2 - the next generation protocol based on a Google project called SPDY to provide higher levels of performance to web applications.
As of March 2018, almost 25% of the top 10 million websites support it - so it is becoming increasingly common. Along with adoption comes the need to be able to validate an application's performance and reliability built upon the technology.
HTTP/2 contains a number of improvements over HTTP 1.x - namely:
Data compression of HTTP headers
HTTP/2 Server Push capability
Fixing some known issues with HTTP 1.x
Multiplexing multiple requests over a single TCP connection
In this guide - we'll be using JMeter to generate HTTP/2 requests against an HTTP/2 enabled target application. We'll also be using the HTTP/2 Sampler which doesn't come included with the default JMeter installation and we'll have to add it in.
First of all it helps substantially to have the JMeter plugins manager installed (full instructions available here: https://jmeter-plugins.org/wiki/PluginsManager/) - this will allow JMeter to successfully install any available add-in as well as any dependencies that are required.
Simply search for the HTTP/2 plugin, select 'HTTP/2 Sampler' from the list and click on the Apply Changes and Restart JMeter. We'll cover how to do this through Flood further into this guide.
You will now have the HTTP/2 Sampler available to be included in your script.
In order to properly test HTTP/2 endpoints - the JMeter test plan must contain updated plugins specifically for the HTTP/2 protocol. These add-ins include modified versions of the default HTTP 1.x plugins - which are:
1. HTTP2 Request Defaults 2. HTTP2 Request 3. Simple Data Writer HTTP2 4. View Results Tree HTTP2
These need to be used in place of their default HTTP counterparts when testing HTTP/2 target sites.
Here's an example of a simple test plan which essentially runs a single thread group with a single asynchronous HTTP/2 request:
Running HTTP/2 tests through Flood will require the upload of these same libraries that were installed on your JMeter local instance via the plugins manager. Since the HTTP/2 plugins use an implementation of Jetty - there are a number of Jetty libraries that JMeter needs to run successfully and they need to be uploaded to Flood alongside the actual script.
A fully functional zip file containing all necessary jar libraries to run HTTP/2 tests through Flood for JMeter 3.3 has the following directory structure:
A copy of the zip file is available for download: here <link to zip file>
As mentioned previously - you will need to upload the zip file along with your script file as follows:
In our example HTTP/2 script we have both HTTP1 & HTTP 2 requests for the same pages & resources. This is intended to see the performance difference between the two versions of protocols in terms of response times.