Categories
Uncategorized

h2load on Ubuntu 18.04

For simple HTTP tests ab ( Apache Bench ) has been very useful. Unfortunately it has one may drawback today: no support for HTTP/2. For that, I recommend h2load, part of the nghtttp2 library.

On Ubuntu 18.04 you can get it as part of the nghttp2-client package, which uses version 1.30.0. For that, a simple sudo apt-get install nghttp2-client will work. If you want to use a more recent release, it isn’t hard to build from source.

Here is a simple script for building nghttp2 with h2load:

sudo apt-get update
sudo apt-get install g++ make binutils autoconf automake \
        autotools-dev libtool pkg-config zlib1g-dev \
        libcunit1-dev libssl-dev libxml2-dev \
        libev-dev libevent-dev libjansson-dev libc-ares-dev \
        libjemalloc-dev cython python3-dev python-setuptools \
        libjemalloc-dev libspdylay-dev

git clone https://github.com/nghttp2/nghttp2.git && cd nghttp2
autoreconf -i && automake && autoconf
./configure – enable-app
make
make install

Running a test based on number of requests, similar to how ab works, is simple:

h2load -n100000 -c100 -m10 https://wordpress.com/
starting benchmark...
spawning thread #0: 100 total client(s). 100000 total requests
TLS Protocol: TLSv1.2
Cipher: ECDHE-RSA-CHACHA20-POLY1305
Server Temp Key: X25519 253 bits
Application protocol: h2
progress: 10% done
progress: 20% done
progress: 30% done
progress: 40% done
progress: 50% done
progress: 60% done
progress: 70% done
progress: 80% done
progress: 90% done
progress: 100% done

finished in 23.23s, 4303.95 req/s, 576.06MB/s
requests: 100000 total, 100000 started, 100000 done, 100000 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 100000 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 13.07GB (14034680653) total, 13.54MB (14202199) headers (space savings 85.79%), 13.04GB (14002549632) data
                     min         max         mean         sd        +/- sd
time for request:    11.73ms       1.96s    195.00ms    135.61ms    79.09%
time for connect:    34.41ms     67.43ms     56.84ms      8.35ms    72.00%
time to 1st byte:    57.60ms    578.96ms    167.02ms    107.88ms    82.00%
req/s           :      43.05       97.70       52.28        9.13    85.00%

Another option is to test for a length of time:

h2load -c100 -m100 – duration=10 – warm-up-time=3 https://wordpress.com/

That runs a 10 second test, with a warm up period of 3 seconds.

Leave a Reply

Your email address will not be published. Required fields are marked *