Skip to content
Latchkey

h2load: HTTP/2 and HTTP/3 Benchmarking

h2load -n 100000 -c 100 -m 10 https://localhost:8443/ sends 100k requests over 100 HTTP/2 connections with 10 concurrent streams each, reporting req/s and latency.

h2load ships with nghttp2 and is the standard way to benchmark HTTP/2, where the key extra knob is -m (concurrent streams per connection). It also does HTTP/1.1 and, in HTTP/3 builds, h3.

What it does

h2load performs -n total requests spread over -c connections, multiplexing -m concurrent streams per connection for HTTP/2. It negotiates the protocol via TLS ALPN (h2) or prior knowledge for cleartext h2c, and reports requests/sec, throughput, and time-for-request percentiles including the min/max/mean/sd.

Common usage

Terminal
# HTTP/2 over TLS: 100k requests, 100 conns, 10 streams each
h2load -n 100000 -c 100 -m 10 https://localhost:8443/

# cleartext HTTP/2 (h2c) with prior knowledge
h2load -n 10000 -c 50 -m 10 --h1=0 http://localhost:8080/

Options

FlagWhat it does
-n <N>Total number of requests
-c <N>Number of connections
-m <N>Max concurrent streams per connection (HTTP/2)
-t <N>Number of native threads
-D <sec>Run for a duration instead of a fixed -n
-H <header>Add a request header
--h1Force HTTP/1.1 even over TLS

In CI

h2load exits 0 on a completed run, so gate on its output: check that the status codes: line shows only 2xx and that the time for request mean/max are within budget. Match -m to the streams your server allows (SETTINGS_MAX_CONCURRENT_STREAMS); overshooting just queues. For HTTP/2, target the h2 port and let ALPN pick the protocol.

Common errors in CI

h2load: command not found needs apt-get install -y nghttp2-client (Debian/Ubuntu) or apk add nghttp2. Warning: Failed to negotiate HTTP/2, fallback to HTTP/1.1 means the server did not offer h2 over ALPN, so you benchmarked HTTP/1.1 by accident; fix the server or use --h1=0 with h2c. [ERROR] Certificate verification failed on a self-signed test cert is cleared with -k/--verify-clients off or by trusting the CA.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →