Commands / Speed and link quality

Speed and link quality

h2load

Also http load test, hpack savings

Sends many HTTP/2 (or HTTP/1.1) requests and reports how they did, header compression included.

-n requests over -c connections; the report counts successes and status codes, and the traffic line says how many bytes were headers and how much HPACK saved compared with sending them as text.

h2load command usage

h2load -n REQUESTS -c CLIENTS [-m STREAMS] URL

Options

-n 20
twenty requests in total
-c 1
one client: one connection
-m 10
up to ten streams at once per connection
-r 1 --rate-period 50ms
open one connection every 50 ms, so the requests overlap instead of all starting at once
--h1
plain HTTP/1.1, one request per connection

h2load examples

h2load -n 20 -c 1 https://webServer.lab/
Twenty requests over one HTTP/2 connection, with the header savings.
h2load -n 100 -c 4 -m 10 https://webServer.lab/
A hundred requests over four connections, ten streams at a time.

Reading the output

$ h2load -n 20 -c 1 https://webServer.lab/
Application protocol: h2
requests: 20 total, 20 started, 20 done, 20 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 20 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 6.42KB (6574) total, 293B (293) headers (space savings 92.99%), 5.72KB (5860) data
  • space savings: how much smaller the headers were than as plain text; the dynamic table makes repeats tiny.

Pitfalls

  • -c counts connections, not requests at once: with one connection, -m sets how many streams run together.

Run it on real machines

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Start with a free account: Google or email, no card.

Open this lab