gcannon Manual · v0.10.0

Manualgcannon 0.10.0 · released 2026-11-23Written from the README and the source

The manual

gcannon opens a set of TCP connections to one server and sends it HTTP/1.1 requests or WebSocket frames, over plain TCP or TLS 1.3, for a fixed time. Then it reports throughput, bandwidth, status codes and latency percentiles. This is everything it can do and how to read what it prints.

Install

Requirements

  • Linux, kernel 6.1 or newer, with io_uring available.
  • liburing-dev and libssl-dev (OpenSSL 3).
  • A C compiler and make.
  • For https:// targets only: kernel TLS, the kernel's tls module. gcannon checks for it at startup.

Build from source

shell
git clone https://github.com/MDA2AV/gcannon.git && cd gcannon
make
sudo cp gcannon /usr/local/bin/

On Debian or Ubuntu the two libraries come from the packages of the same name:

shell · Debian / Ubuntu
sudo apt install build-essential liburing-dev libssl-dev

Note Ubuntu 24.04's liburing 2.5 builds it. gcannon uses liburing's provided-buffer-ring helpers (io_uring_setup_buf_ring), which an older distribution's package may lack: build liburing from source there, as HttpArena's container image does with liburing 2.9.

Check the result. --version new in 0.8.0 prints the version and exits:

shell
gcannon --version
stdout
gcannon 0.10.0

make clean removes the build. HTTP parsing uses picohttpparser, vendored in the repository, so there is nothing else to fetch.

Quick start

The shape of every command is a URL plus three numbers: connections (-c), threads (-t) and duration (-d). Everything else is optional.

shell
# HTTP benchmark: 512 keep-alive connections on 8 threads for 10 seconds
gcannon http://localhost:8080/ -c 512 -t 8 -d 10s

# HTTP with pipelining: 16 requests in flight per connection
gcannon http://localhost:8080/ -c 512 -t 8 -d 10s -p 16

# WebSocket echo
gcannon http://localhost:8080/ws --ws -c 512 -t 8 -d 10s

# HTTPS (TLS 1.3)
gcannon https://localhost:8443/ -c 512 -t 8 -d 10s

# Raw request files (multiple templates)
gcannon http://localhost:8080 --raw get.raw,post.raw -c 256 -t 4 -d 5s

Four things to get right

-c is the total
It is split evenly over the threads. -c 512 -t 8 is 64 connections per thread, and -c must be at least -t.
Give gcannon its own cores
If it shares cores with the server, you measure the two fighting. Pin them apart, for example with taskset.
The run starts after a warmup
gcannon waits at least 100 ms and until every connection is set up, resets its counters, then measures for exactly -d.
Check the status line and the exit code
gcannon expects status 200 (-s changes that). If responses come back in another status class it prints a warning and exits with code 1.

Four questions, four load models

Closed loop, the default
Each connection sends its next request as soon as the last response arrives. It answers: how fast can this server go?
Fixed rate, --rate new in 0.8.0
The request rate is held constant and each request is timed from its scheduled slot. It answers: what does this load cost, and how long does a request wait?
A p99 ramp, --ramp-p99 new in 0.9.0
A closed loop whose fleet grows a step at a time until p99 goes over a limit. It answers: how many connections does this server hold within a latency budget?
Idle connections, --idle new in 0.10.0
Part of the connections open, ask once and go quiet, while the rest hold their load. It answers: which of them does this server keep, and which does it shed, and when?

Modes

Keep-alive HTTP default

Given a plain URL, gcannon builds one HTTP/1.1 GET request for it and sends that request on every connection, keeping the connections open for the whole run. Each connection sends its next request when the previous response has arrived.

shell
gcannon http://localhost:8080/json -c 1024 -t 16 -d 10s

If responses are large, raise the receive buffer size. Each worker allocates 4,096 buffers of --recv-buf bytes (default 4096, minimum 512):

shell
gcannon http://localhost:8080/ -c 512 -t 8 -d 10s --recv-buf 16384

Pipelining -p N

With -p N each connection keeps N requests in flight. The N requests are pre-built into a single buffer and go out in one send; as responses complete, gcannon sends the same number of new requests, so if five responses arrive, five requests follow. The depth can be up to 64 (larger values are capped at 64).

shell
gcannon http://localhost:8080/json -c 1024 -t 16 -d 10s -p 16

Note The server has to support HTTP/1.1 pipelining. Requests that leave in one send share that send's timestamp, and latencies are matched to responses in order, so a pipelined latency includes the time a response spent queued behind the ones before it.

Short-lived connections -r N

-r N closes each connection after N requests and opens a new one, so the run includes connection setup. The default is unlimited: connections stay open. The Reconnects: line in the output counts the reopenings.

shell
# Reconnect after every 100 requests
gcannon http://localhost:8080/ -c 512 -t 8 -d 10s -r 100

Raw request templates --raw a,b,c

--raw takes a comma-separated list of files (up to 64) and sends the exact bytes of each one. That gives you mixed GET and POST workloads, specific headers, chunked bodies and byte-exact reproduction of a request.

shell
gcannon http://localhost:8080 --raw get.raw,post.raw,upload.raw -c 256 -t 4 -d 5s

Because the bytes go out untouched, each file must be a complete HTTP/1.1 request: CRLF line endings and the empty line that ends the headers. printf is a reliable way to write one:

shell
printf 'GET /json HTTP/1.1\r\nHost: localhost:8080\r\n\r\n' > get.raw
printf 'POST /echo HTTP/1.1\r\nHost: localhost:8080\r\nContent-Length: 2\r\n\r\n20' > post.raw
  • Templates are handed out round-robin across the connections, so each connection sends one request type. With -r, a connection moves on to the next template every time it reconnects.
  • The URL still says where to connect. Without a URL, gcannon takes host and port from the Host: header of the first file.
  • With more than one template the output adds Templates: to the banner and per-template response counts (Per-template: and Per-template-ok:) to the summary. Add --per-tpl-latency for percentiles per template.

Dynamic placeholders {RAND} {SEQ}

A raw template can contain one placeholder that gcannon replaces on every request at send time. That is what makes create, read, update and delete benchmarks possible: every request can address a different row.

{RAND:min:max} random number in a range

A random value between min and max, inclusive, from a per-connection xorshift64 generator, so threads never contend for it.

crud-read.raw
GET /items/{RAND:1:100000} HTTP/1.1
Host: localhost:8080

On the wire: /items/042357, /items/089124, /items/000017, …

{SEQ:start} counter shared by all threads

A value that rises by one per request from start, taken from one atomic counter shared by every thread, so no two requests get the same value.

crud-create.raw
POST /items HTTP/1.1
Host: localhost:8080
Content-Type: application/json
Content-Length: 72

{"id":{SEQ:100001},"name":"Bench","category":"test","price":100,"qty":50}

On the wire: "id":100001, "id":100002, "id":100003, …

Rules that keep Content-Length correct

  • The substituted value always has the same width, so Content-Length never changes. Write the header for the substituted length, not for the placeholder text.
  • {RAND} values are zero-padded to the number of digits in max. That is fine in a URL path. Inside a JSON number, leading zeros are invalid, so use it there only when min and max have the same number of digits.
  • {SEQ} values are written at the number of digits in start, with no leading zeros, so they are safe inside JSON numbers. Pick a start with room to grow: {SEQ:10000001} allows about 89 million increments at 8 digits. A start just below a power of ten, such as {SEQ:999995}, runs out of width almost at once.
  • One placeholder per template: the first {RAND: or {SEQ: found.
  • With pipelining, each request in the batch gets its own value.

A CRUD run

shell
gcannon http://localhost:8080 \
  --raw crud-read.raw,crud-read2.raw,crud-update.raw,crud-create.raw,crud-delete.raw \
  -c 512 -t 64 -d 5s
  • crud-read.raw: GET /crud/{RAND:1:100000} reads random existing rows.
  • crud-update.raw: PUT /crud/{RAND:1:50000} updates rows in the first half.
  • crud-create.raw: POST /crud with {SEQ:100001} in the body creates unique rows.
  • crud-delete.raw: DELETE /crud/{RAND:50000:100000} deletes rows in the second half.

WebSocket echo --ws

--ws upgrades each connection to WebSocket over HTTP/1.1, then sends frames and counts the echoes that come back. The target is still written as an http:// or https:// URL. -p works here too and sets how many frames are in flight per connection.

shell
gcannon http://localhost:8080/ws --ws -c 4096 -t 64 -d 5s -p 16

# Custom message (--ws-msg turns on WebSocket mode by itself)
gcannon http://localhost:8080/ws --ws-msg '{"type":"ping"}' -c 256 -t 8 -d 5s

The default message is hello. The summary reports frames sent and received, WS upgrades:, WS frames: and, if the server refused any, WS upgrades refused:.

HTTPS over kernel TLS https://

An https:// URL runs over TLS 1.3. OpenSSL does the handshake only; the record keys then go to kernel TLS (kTLS), which encrypts and decrypts on the socket itself. The io_uring hot path is the same as for http://, and every mode works over TLS: pipelining, --raw, placeholders, -r and --ws.

shell
gcannon https://localhost:8443/ -c 512 -t 8 -d 10s -p 16
gcannon https://localhost:8443/ws --ws -c 256 -t 8 -d 5s

Warning The server certificate is not verified. SNI is the URL's host name, and is not sent for an IP address.

  • TLS 1.3 only, with the suites kernel TLS supports: AES-128-GCM (offered first), AES-256-GCM and ChaCha20-Poly1305.
  • Session tickets are ignored, so with -r every connection does a full handshake.
  • Kernel TLS is required and checked at startup. If the kernel refuses, gcannon stops with Error: https:// needs kernel TLS and asks whether the tls module is loaded (sudo modprobe tls loads it).
  • Handshake failures count as connect errors. Failures after the handshake count as read errors: a record that does not decrypt, a fatal alert, or a server KeyUpdate (rekeying is not supported). The reason for the first TLS failure is printed to stderr.
  • Bandwidth counts decrypted bytes. The default port is 443.

Fixed-rate mode new in 0.8.0 --rate N

Every other mode sends the next request as soon as the last response arrives, so it answers “how fast can this server go”. --rate holds the total request rate fixed instead and answers “what does this load cost, and how long does a request wait”.

shell
# 5,000 req/s over 200 keep-alive connections
gcannon http://localhost:8080/ -c 200 -t 4 -d 30s --rate 5000

Two rules --rate needs -p 1 (the default) and cannot be combined with -r. gcannon refuses to start otherwise: a pipeline would send several requests on one schedule slot, and a per-connection quota would end a connection's schedule early.

One schedule per connection, one shared clock
The interval is connections ÷ rate. Each thread spreads its connections evenly over the whole interval, with the threads’ slots interleaved, so the fleet sends evenly spread instead of in waves, however long it takes to connect, and no thread carries more than its share of the rate. A connection starts at its first slot after it is up. With --ramp-up the thread owns the schedule instead, as idle connections explains.
Latency counts from the scheduled time
This is coordinated-omission correction. A server that stalls makes every request scheduled during the stall wait, and each is charged its wait. Timing from the send would only charge the requests already on the wire.
A late schedule is caught up, not reset
A connection that fell behind, because its response was slow or it was reconnecting, sends its owed requests back to back, each still timed from its own slot.
Sends go out on time
The event loop sleeps exactly until the next send is due, with the thread's timer slack set to 1 ns. The Schedule: line reports how many sends left more than 1 ms late and the largest lag seen, so every run checks its own generator.

Very large fleets

Fixed-rate mode is how you hold hundreds of thousands of mostly idle connections open and still send at a known rate. Four options exist for that:

--addr-span N 0.8.0
Spread the connections over N consecutive IPv4 addresses starting at the target's (127.0.0.1, .2, …). One source address holds at most about 64K connections to one destination address and port, and every 127.x.y.z address is local, so a server listening on 0.0.0.0 takes a million connections spread over 32 loopback addresses.
--connect-limit N 0.8.0
Keep at most N first connection attempts in flight per thread; each completion starts the next. A million SYNs at once overflow any listen backlog, and every retry costs seconds. Over https:// an attempt counts until its TLS handshake is done, so the server is never handed more handshakes than it finishes: the ones at the back would wait past its handshake timeout and be closed.
--warmup-max D 0.8.0
The longest the warmup waits for connections to be set up before measuring anyway. The default is 10 s; a large fleet needs long enough to open them all.
--settle D 0.8.2
Once every connection is up, or --warmup-max runs out, keep the load running D longer before the counters reset and the window opens. A server that has just accepted a million connections can still be working through its accept backlog, or collecting garbage for the first time, and the window should measure what comes after. The default is 0.
shell
# 250K req/s spread over 1M keep-alive connections: one request per
# connection every 4s, the fleet spread over 127.0.0.1-127.0.0.32
gcannon http://127.0.0.1:8080/ -c 1000000 -t 64 -d 20s \
    --rate 250000 --addr-span 32 --connect-limit 512 --warmup-max 3m

Signals for wrapper scripts

With --rate, gcannon writes two lines to stderr: gcannon: warmup done, measuring for <N>s when the measured window opens and gcannon: measurement done when it closes, before any connection is torn down. A wrapper can use them to sample something else, such as the server's cgroup CPU, over exactly the measured window. With --settle, gcannon: all connections up, settling for <N>s comes first, and warmup done still marks exactly the window.

A p99 ramp new in 0.9.0 --ramp-p99 T

--ramp-p99 finds how many connections a server takes before its p99 goes over a threshold. The fleet grows a step at a time and stays open in between. Each step opens its new connections, waits until they are up (like the warmup, within --warmup-max, then --settle), measures one -d window and checks it. The ramp stops at the first step that fails, or at -c.

shell
# From 64 connections, doubled every step, until p99 goes over 5 ms or the
# fleet reaches 8192; each step measures for 5s
gcannon http://localhost:8080/ -t 8 -c 8192 -d 5s --ramp 64 --ramp-p99 5ms

Two rules The threshold takes a unit (500us, 5ms, 1.5s) and must be under 5 s, the top of the latency histogram. --ramp-p99 cannot be combined with --rate, which lays its send slots out for the whole fleet, so a fleet part of the way up would send in bursts, or with --tui, whose progress bar counts down one fixed duration.

Steps
--ramp N is the first step’s connection count, one per thread by default, and must be at least -t and at most -c. --ramp-step x2 (the default) multiplies it each step, rounding up, x1.5 by any factor above 1, and +256 adds to it. -c is the last step, and -d is each step’s window.
p99 once per step, not per request
Workers record latencies into their histograms as in any other run. As a window closes, each worker copies its stats out from its own thread, and the main thread merges the copies and works out p99 from them. The per-request path does not change.
What fails a step
Its p99 is over the threshold, or connections could not get a socket (ulimit -n), or not all of them were set up within --warmup-max, or there were no responses, or a connection waited the whole window on a request the server never answered, or responses had an unexpected status (-s), or there were connect or read errors or refused WebSocket upgrades.
A failing step is measured once more
Straight away, before the ramp stops, so one noisy window does not end it early. This does not apply when connections lost their sockets, since they never get them back.

Why the unanswered check A closed loop sends nothing more on a connection that is waiting. A server that never answers some connections, a full accept queue say, leaves no latency sample for them, while the ones it does answer keep p99 low.

Reading a ramp

The step table prints as the ramp goes, on stderr with --json. Below it come the results of the last step that passed, or of the last step if none did, and a line that sums up. Here it runs against tests/ramp_server.py --service-ms 2 from gcannon’s repository, which answers one request at a time in 2 ms each, so p99 grows by about 2 ms per connection:

stdout · README example
  Ramp:      from 1 connection, x2 per step, while p99 stays within 12.00ms

     Conns      Req/s       p50       p90       p99     p99.9
         1        474    2.11ms    2.14ms    2.25ms    2.34ms
         2        472    4.22ms    4.28ms    4.35ms    4.52ms
         4        472    8.45ms    8.56ms    8.78ms    9.06ms
         8        473   16.80ms   17.00ms   17.30ms   17.40ms   p99 over 12.00ms, measuring again
         8        473   16.80ms   17.00ms   17.50ms   17.70ms   p99 over 12.00ms

  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   8.45ms   8.45ms   8.56ms   8.78ms   9.06ms
  ...
  Ramp:       held p99 within 12.00ms up to 4 connections (p99 8.78ms); at 8, p99 over 12.00ms
  • Doubling brackets the answer. The limit lies between the last step that passed and the one that failed. To narrow it, run again from the passing count with +n steps.
  • The exit code is 1 if no step passed. --json describes the same step as the text and adds a ramp block with every window measured.
  • The answer is the concurrency at which p99 holds in a closed loop. A stall there delays only the requests already sent, so it weighs less in p99 than it would for an open stream of requests, which is what --rate measures.

Idle connections and a timed ramp new in 0.10.0 --idle N, --ramp-up D

A server holds far more connections than it serves at once, and sheds the ones that go quiet. --idle makes part of -c those connections. Each one opens, sends one request, reads the response, and is then left alone: nothing is sent on it again, and it is never reopened when the server closes it. The rest of -c is the active fleet. Keep-alive timeouts, connection limits and anything else the server does to idle connections then show in the report.

shell
# 1M connections, 900K of them idle: 4000 active ones first, the rest of both
# opened evenly over 2 minutes, at a fixed 100K req/s throughout
gcannon http://127.0.0.1:8080/ -c 1000000 -t 64 -d 5m --rate 100000 \
    --idle 90% --ramp 4000 --ramp-up 2m --addr-span 128 --connect-limit 512

Where it stops --idle and --ramp-up cannot be combined with --ws, --tui or --ramp-p99. --ramp-up needs --ramp. At least -t connections have to stay active.

--idle
A count, or a share of -c: 900000 or 90%. Without --ramp-up the idle connections all open when the measured window does.
--ramp and --ramp-up
--ramp N of the active connections open in the warmup, which waits for them, then --settle. Once the window opens, the rest of the active ones and every idle one open evenly over --ramp-up, which runs inside -d and so cannot be longer.
The rate belongs to the thread
With --rate and --ramp-up, active connections come and go, so none can own a schedule. Each thread paces its share of the rate and hands every due request to whichever of its active connections has been free the longest, and latency counts from the slot. The rate is the same however many are open. Without --rate the active connections send as fast as they can.
Counted apart
An idle connection’s request, response and errors stay out of the results, the latency and the exit code, which are the active connections’. One that cannot connect, or never gets its answer, is reported as failed or as still waiting, and is not retried.
Only what outlasts the timeout is shed
A run, or a ramp, shorter than the server’s timeout ends with every idle connection still open. The report says how many, and how long each shed connection had been idle.
Ports and files
Past half the ephemeral port range to one destination address, which is 14,000 connections of the 28,000 ports a default Linux has, the kernel searches for a free port for each new connection: a few hundred microseconds each, which delays whatever else the thread is doing. Spread a large fleet with --addr-span. ulimit -n has to cover -c.

Reading a ramp-up

Every interval the workers hand their counters over, and main prints a line: connections open (Active and Idle), idle ones opened and closed so far, and the active connections’ rate and latency in the interval. Here it runs against tests/idle_server.py --idle-timeout 2 from gcannon’s repository, which closes a connection 2 s after its last request, with -c 200 -t 2 -d 8s --rate 500 --idle 80% --ramp 8 --ramp-up 4s:

stdout · README example
     Time    Active      Idle    Opened    Closed      Req/s       p50       p99     p99.9
     1.0s        16        40        40         0        499      17us     144us     199us
     2.0s        24        80        80         0        500      20us     328us   12.50ms
     3.0s        32        80       120        40        500      19us      99us     115us
     4.0s        40        80       160        80        500      20us     109us     129us
     5.0s        40        40       160       120        500      19us      76us     103us
     6.0s        40         0       160       160        499      19us      82us      94us
  ...
  Phases:     ramp 4s: 500 req/s, p50 19us, p99 117us, p99.9 8.57ms; after 4s: 499 req/s, p50 19us, p99 77us, p99.9 135us
  Idle:       160 asked for, 160 opened, 160 answered, 0 failed
              first response p50 71us, p99 277us
              160 closed by the server (first after 2.0s idle, median 2.0s, last 2.0s), 0 still open at the end
  • Opened and Closed count over the whole run, Idle what is open at that moment.
  • The last line of the idle block says how many the server closed, how long the first, the median and the last of them had been idle, and how many are still open. A server that keeps them prints none closed by the server.
  • A server that sends something on an idle connection, such as a 408 before it closes it, is counted: N were sent data nobody asked for. A connection still waiting for its answer when the run ends is counted too.
  • Phases: compares the rate and latency while the connections opened with what came after. --json adds idle, ramp_up, phases and timeline; the lines go to stderr.

Options

The complete list for gcannon 0.10.0. Options marked with a version, like 0.10.0, are new in it.

FlagDefaultWhat it does
<url>requiredTarget URL, http:// or https://. Port defaults to 80 or 443, path to /. Optional when --raw is given: host and port then come from the first file's Host: header.
-c N100Total connections, split evenly over the threads. At least 1 and at least -t. With --ramp-p99, the last step; with --idle, the idle ones included.
-t N1Worker threads. At least 1.
-d D10sMeasured duration: 5s, 1m, or a bare number of seconds. At least 1 second. With --ramp-p99, each step’s window.
-p N1Pipeline depth: requests (or WebSocket frames) in flight per connection. At least 1; values above 64 are capped at 64.
-r NunlimitedRequests per connection; the connection is closed and reopened after N. Not allowed with --rate.
-s CODE200Expected HTTP status code. If responses fall outside its class (2xx, 3xx, 4xx or 5xx), gcannon warns and exits with code 1.
--raw F,…
-R F,…
noneComma-separated raw request files, sent byte for byte. Up to 64 templates. See raw templates and placeholders.
--wsoffWebSocket echo mode.
--ws-msg TEXThelloWebSocket message payload. Turns on WebSocket mode.
--tuioffTerminal UI: progress bar, live sparkline, coloured results, latency histogram and run history.
--jsonoffPrint one JSON object to stdout, with no banner or progress.
-b N
--buckets N
10Histogram buckets in TUI mode (adaptive, at most 100).
--recv-buf BYTES4096Receive buffer size, from 512 to 4194304. Each worker allocates 4,096 buffers of this size. Larger values suit big responses; smaller values save memory.
--cqe-latencyoffTake the response timestamp when the completion arrives, before parsing, instead of after the response is parsed.
--per-tpl-latencyoffSeparate latency histogram per template. Takes effect with --raw and more than one template.
--rate N new in 0.8.0closed loopFixed total request rate in requests per second, paced per connection; latency counts from each request's scheduled time. Must be positive. Needs -p 1 and no -r. See fixed-rate mode.
--addr-span N new in 0.8.01Spread connections over N consecutive IPv4 addresses starting at the target's. 1 to 65536. One source address holds at most about 64K connections to one destination.
--connect-limit N new in 0.8.0all at onceFirst connection attempts in flight per thread; each completion starts the next. Over https:// an attempt counts until its TLS handshake is done.
--warmup-max D new in 0.8.010sLongest the warmup waits for connections to be set up before measuring anyway. Same format as -d; at least 1 second. With --ramp-p99, per step.
--settle D new in 0.8.20How long the load keeps running once every connection is up, or --warmup-max ran out, before the counters reset and the window opens. Same format as -d; not negative. With --ramp-p99, per step.
--ramp-p99 T new in 0.9.0offGrow the connections a step at a time until p99 goes over T: a latency with its unit (500us, 5ms, 1.5s), under 5 s. -c is the last step and -d each step’s window. Not with --rate or --tui. See the p99 ramp.
--ramp N new in 0.9.0-tThe first step’s connection count (--ramp-p99), or the active connections that open before the ramp (--ramp-up). At least -t, and at most -c or the active connections. Needs one of the two.
--ramp-step S new in 0.9.0x2How the steps grow: x and a factor above 1 multiplies, rounding up; + and a count adds. Needs --ramp-p99.
--idle N new in 0.10.0noneConnections of -c that open, send one request and are then left alone: a count or a percentage (900000, 90%). The rest, at least -t of them, are active. Not with --ws, --tui or --ramp-p99. See idle connections.
--ramp-up D new in 0.10.0offOpen the connections beyond --ramp evenly over D, inside the measured window, idle ones included. Same format as -d; at least 1 second and at most -d. Needs --ramp. Not with --ws, --tui or --ramp-p99.
--version new in 0.8.0exitsPrint the version and exit.
--clear-historyexitsClear the saved run history (~/.gcannon/history.bin) and exit.

What gcannon refuses

Arguments are checked before anything connects. These are the messages you can meet:

  • Error: -c (2) must be at least -t (4); every thread needs at least one connection
  • Error: --rate needs -p 1 (got -p 16)
  • Error: --rate cannot be combined with -r
  • Error: --rate must be a positive number of requests/s
  • Error: --addr-span must be 1..65536 (got 0)
  • Error: --settle must not be negative (got -1)
  • Error: --ramp-p99 takes a latency with its unit, like 5ms, 500us or 1.5s (got '5')
  • Error: --ramp-p99 must be under 5s, the top of the latency histogram
  • Error: --ramp-p99 cannot be combined with --rate
  • Error: --ramp-p99 cannot be combined with --tui
  • Error: --ramp needs --ramp-p99 or --ramp-up
  • Error: --ramp-step needs --ramp-p99
  • Error: --ramp (1) must be at least -t (2); every thread needs at least one connection
  • Error: --ramp (8) must not be above -c (4), where the ramp stops
  • Error: --ramp-step takes x<factor> above 1 or +<connections> (got 'x1')
  • Error: --idle takes a number of connections or a percentage of -c, like 900000 or 90% (got '0')
  • Error: --idle (99) leaves 1 of -c (100) active, fewer than -t (2); every thread needs at least one
  • Error: --idle cannot be combined with --tui
  • Error: --ramp-up needs --ramp <n>, the active connections that open first
  • Error: --ramp (60) must not be above the 50 active connections
  • Error: --ramp-up (10s) must not be longer than -d (5s), the window it runs inside
  • Error: --ramp-up cannot be combined with --ramp-p99
  • Error: --recv-buf must be at least 512
  • Error: at most 64 --raw templates supported (got 65)
  • Error: only http:// and https:// URLs supported

An unknown flag, or a flag missing its value, prints the usage line and exits with code 1.

Reading the output

Default output

A banner with the settings, a latency table, then the totals. This is the example from the gcannon README, not a measurement shown by this site:

stdout · README example
gcannon — io_uring HTTP load generator
  Target:    localhost:8080/json
  Threads:   8
  Conns:     512 (64/thread)
  Pipeline:  16
  Duration:  5s

  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   1.82ms   1.70ms   2.50ms   4.90ms   7.10ms

  4823901 requests in 5.00s, 4823901 responses
  Throughput: 964.78K req/s
  Bandwidth:  72.36MB/s
  Status codes: 2xx=4823901, 3xx=0, 4xx=0, 5xx=0
  Reconnects: 0

Note The README example predates 0.8.0. Today the first line reads gcannon v0.10.0, the banner also prints Req/conn: and Expected:, the summary adds Latency samples:, and Reconnects: appears only when it is not zero. Every line 0.10.0 can print is in the table below.

The lines, in the order gcannon 0.10.0 prints them
LinePrintedMeaning
gcannon v0.10.0alwaysThe version. Active modes follow in brackets when set: [WS], [TUI], [CQE], [TPL].
Target:alwaysHost, port and path as gcannon parsed them.
TLS:https://1.3 via kernel TLS (certificate not verified).
Threads:
Conns:
alwaysWorker threads, total connections, and how many each thread owns. With --ramp-p99, up to the last step.
Pipeline:
Req/conn:
alwaysThe -p depth and the -r quota. unlimited (keep-alive) means connections are never closed on purpose.
Templates:--raw, 2+ filesHow many templates are in rotation.
Expected:alwaysThe status code from -s. Responses outside its class make the run exit with code 1.
Duration:alwaysThe measured window. Warmup comes before it and is not counted. With --ramp-p99, per step.
Addresses: 0.8.0--addr-span > 1The range of target addresses the connections are spread over.
Rate: 0.8.0--rateIn the banner: the target rate and the resulting interval per connection, connections ÷ rate.
Ramp: 0.9.0--ramp-p99In the banner: from N connections, x2 per step, while p99 stays within T.
Ramp-up: 0.10.0--ramp-upIn the banner: from N to M active connections over Ds. With --rate, Rate: then reads over whichever active connections are open.
Idle: 0.10.0--idleIn the banner: N of M connections (P%), one request each.
Time Active Idle … 0.10.0--idle, --ramp-upOne line per interval, on stderr with --json: how many connections are open (the idle columns only with --idle), how many idle ones have been opened and closed so far, and the active ones’ req/s and latency in the interval. A line with failed connections ends with how many there have been so far.
Conns Req/s p50 … 0.9.0--ramp-p99The step table, one row per window as the ramp goes, on stderr with --json. A failing step’s row ends with the reason, such as p99 over T, N errors or N connections got no response, and the first time with , measuring again. The results below it are the last passing step’s, or the last step’s if none passed.
LatencyalwaysAverage and the 50th, 90th, 99th and 99.9th percentiles over all threads, in us (microseconds), ms or s. In closed-loop runs the clock starts when the send is prepared; with --rate it starts at the request's scheduled time.
N requests in Ts,
N responses
alwaysRequests sent and responses fully received inside the measured window. In WebSocket mode this line counts frames sent and received.
Throughput:alwaysResponses per second of measured time, with K or M for thousands or millions.
Bandwidth:alwaysBytes received per second, headers included. Over TLS it counts decrypted bytes.
Status codes:HTTPResponses by status class. An other= count appears if any response fits none of them.
WS upgrades:
WS frames:
--wsUpgrades completed and frames echoed. WS upgrades refused: appears if the server refused any.
Latency samples:alwaysHow many of the responses contributed a latency sample. Below 100% the percentiles describe only part of the run.
Latency overflow (>5s):if anyResponses that took longer than the histogram covers.
Reconnects:if anyConnections reopened: -r, or the server closed them.
Errors:if anyconnect N, read N, timeout N.
Per-template:
Per-template-ok:
--raw, 2+ filesResponses, and 2xx responses, per template in the order the files were listed.
Rate: 0.8.0--rateIn the summary: target N req/s, achieved N (P%). Below 100% the server, or gcannon, did not keep up.
Schedule: 0.8.0--rateN paced sends, N more than 1ms late, max lag T. This is the check on the generator itself.
Active: 0.8.0--rateN of M connections open at the end.
Phases: 0.10.0--ramp-up, --idleIn the summary: req/s and latency percentiles while the connections opened (ramp) and after (after).
Idle: 0.10.0--idleIn the summary, three lines. How many idle connections were asked for, opened, answered and failed (and, when there are any, how many are not opened by the end, or are still waiting for their response); first response percentiles; and how many the server closed, when (first after S idle, median S, last S), and how many are still open. Further lines appear for unexpected statuses and for data nobody asked for.
Ramp: 0.9.0--ramp-p99In the summary: held p99 within T up to N connections (p99 P), then why it stopped: ; at M, and the failing step’s reason, or , the -c ceiling. at no step means none passed, and the exit code is then 1.

Two warnings can accompany a run:

  • WARNING: N/M responses (P%) had unexpected status (expected 2xx), together with exit code 1.
  • Warning: N of M connections still not set up after 10s of warmup; measuring anyway on stderr when the warmup hit --warmup-max.

Terminal UI --tui

During the run you get a progress bar, live throughput and a sparkline of requests per second. The examples in this section are the illustrations from the gcannon README.

--tui · while running · README example
  ████████████████████████████░░░░░░░░░░░░  70%   7s / 10s
  1.23M req/s  │  8.65M responses  │  456.78MB/s
  Req/s ▂▅▇█████▇▆▇████▇▆▅▆▇█              peak 1.45M

At the end it prints coloured tables for latency, throughput and status codes, then a latency histogram. The bucket boundaries are computed from the latencies actually seen, not from fixed thresholds; -b sets how many buckets (default 10, at most 100).

--tui · latency distribution · README example
  Latency Distribution

    ≤  1.17ms  ██                                  2.45%
    ≤  1.34ms  ██████████████                     18.32%
    ≤  1.51ms  ██████████████████████████████     38.21%
    ≤  1.68ms  ████████████████████               24.56%
    ≤  1.85ms  ████████                            9.87%
    ≤  2.02ms  ████                                4.12%
    ≤  2.19ms  █                                   1.34%
    >  2.19ms  ▏                                   1.13%
shell
gcannon http://localhost:8080/ --tui -b 30   # 30 buckets for more detail
gcannon http://localhost:8080/ --tui -b 5    # 5 buckets for a compact view

Run history. TUI mode also draws bar graphs of requests per second and average latency over the last 10 runs, with a Y axis that adapts so small differences show. Results are saved after every run, in any output mode, to ~/.gcannon/history.bin (up to 100 runs). gcannon --clear-history deletes them.

JSON --json

For scripts, CI and dashboards. gcannon prints a single JSON object to stdout and nothing else: no banner, no progress. With --ramp-p99, the step table goes to stderr.

shell
gcannon http://localhost:8080/ -c 512 -t 8 -d 10s --json
gcannon http://localhost:8080/ -c 512 -t 8 -d 5s --json | jq '.rps'
KeyTypeMeaning
versionstringgcannon version, for example "0.10.0".
targetstringHost, port (omitted when 80) and path.
modestring"http" or "websocket".
connections
threads
pipeline_depth
duration_sec
numberThe run's settings.
elapsed_secnumberMeasured time actually elapsed.
requests
responses
numberTotals inside the measured window.
rpsnumberResponses per second.
bandwidth_bps
bytes_read
numberBytes received per second, and in total.
latency_usobjectavg, p50, p90, p99, p999 in microseconds, and samples.
ws_upgrades
ws_upgrade_failures
ws_frames
numberWebSocket mode only.
statusobjectCounts for 2xx, 3xx, 4xx, 5xx and other.
errorsobjectCounts for connect, read and timeout.
reconnectsnumberConnections reopened.
per_templatearrayWith more than one template: responses and 2xx per template, plus latency_us (avg, p50, p99) with --per-tpl-latency.
rate 0.8.0objectWith --rate only: target, achieved, ratio, paced_sends, late and max_lag_us.
connections_active 0.8.0numberWith --rate only: connections open at the end.
ramp 0.9.0objectWith --ramp-p99 only. p99_max_us is the threshold. max_connections is the last step that passed, 0 if none did. stopped is the failing step’s reason (p99, errors, status, silent, responses, setup or sockets), ceiling, or interrupted after Ctrl-C. steps lists every window measured, with connections, set_up, active, elapsed_sec, responses, rps, latency_us, errors, unexpected, silent, dead, retry, pass and, for a failed step, fail. The rest of the object describes the last step that passed, or the last step if none did.
ramp_up 0.10.0objectWith --ramp-up only: sec, from (the floor) and to (every active connection).
idle 0.10.0objectWith --idle only: connections, opened, answered, failed, connect_errors, read_errors, not_opened, unexpected_status, unsolicited, closed_by_server and open_at_end. With closes, closed_after_s is how long a closed connection had been idle: first, p50, p90, p99, last. first_response_us has p50, p99 and samples.
phases 0.10.0objectWith --ramp-up or --idle: ramp and/or hold, each with sec, rps, p50_us, p99_us and p999_us.
timeline 0.10.0arrayWith --ramp-up or --idle: one object per interval, with t, active, rps, p50_us, p99_us and p999_us, and, with --idle, idle_open, idle_opened, idle_answered, idle_closed and idle_failed.

Per-template latency --per-tpl-latency

With several raw request files, this keeps a separate latency histogram for each template, so a slow POST cannot hide behind a fast GET.

shell
gcannon http://localhost:8080 --raw get.raw,post.raw --per-tpl-latency -c 256 -t 4 -d 5s

The summary gains a Per-template latency: table with one row per template, numbered from #0 in the order the files were listed, each with average, p50, p90, p99 and p99.9. The histograms are only allocated when the flag is passed.

How it works

The main thread starts N workers, waits for the warmup, lets them run for the duration, then joins them, merges their statistics and prints. All the work happens in the workers, and no worker waits on another. The front page draws one worker's loop.

  1. connectAsynchronous connect through the ring. For https://, an OpenSSL handshake follows, then the keys move to kernel TLS.
  2. sendOne send of a buffer that was built before the run and already holds the whole pipeline.
  3. recvA multishot receive, armed once, keeps delivering completions as data arrives.
  4. countA streaming parser finds the end of each response, records its status and its latency.
  5. refillAs many new requests go out as responses came in. With -r, the connection reconnects after its quota.
One thread, one ring
Each worker owns an io_uring ring, set up with SINGLE_ISSUER and DEFER_TASKRUN to keep kernel transitions to a minimum, plus its share of the connections (connections ÷ threads). There are no locks and no cross-thread messages on the hot path.
Provided buffer ring
Each worker registers 4,096 receive buffers of --recv-buf bytes with the kernel up front. The kernel picks a buffer from that pool for incoming data, and the worker hands it back after parsing. Nothing is allocated per receive.
Multishot receive
One submission arms a continuous receive for a connection; from then on every arrival of data produces a completion with no further system call per receive. TLS connections use multishot recvmsg so the worker can see TLS record types.
Batched completions
The loop takes up to 2,048 completions per iteration. Send and receive completions can land in the same batch, in either order, and the loop is written to handle both without stalling a pipeline.
Pre-built requests
Nothing is formatted per request. The pipeline buffer is built once; a template with a placeholder is copied into a per-connection scratch buffer and the value overwritten in place.
Generation counters
Every submission carries the connection's generation in its user data, so a completion that belongs to a connection since reconnected is recognised and dropped.
Latency histogram
Every response is recorded in a fixed two-tier histogram per worker: 1 µs buckets up to 10 ms, then 100 µs buckets up to 5 s. Percentiles are read from the merged histograms; anything longer is reported as overflow.
Latency clock
From the moment the send is prepared, not when the kernel completes it, to the moment the response is fully parsed. --cqe-latency stops the clock at completion arrival instead; --rate starts it at the scheduled time.
Warmup
At least 100 ms, and until every connection has been set up or has failed once and is retrying, capped by --warmup-max (10 s by default), and --settle then keeps the load running that much longer. Then each worker zeroes its own counters and the measured window begins. Ctrl-C during warmup exits with code 130 and prints no result.
Teardown
When the window closes, each worker ends its pending receives (shutdown(SHUT_RD), which sends nothing) and closes its own connections, all workers at once, so nothing is left established when gcannon returns. On the wire the close is a FIN, or an RST with -r. The teardown is not part of the window: elapsed_sec ends when the last worker stopped counting.
Idle connections
Each opens, sends one request from its own path, reads the one response, then sits with a receive armed: the server’s close, or anything it sends, arrives as a completion and is counted. Nothing is ever sent on it again, and it is never reopened.
The rate by thread
With --rate and --ramp-up, active connections come and go, so a connection’s own schedule would lose the total. Each thread keeps its share of it instead: a request every period, taken by the connection that has been free the longest. A slot that finds none free waits, and its latency counts from the slot.
File table
Opening connections inside the measured window would stall the workers each time the process’s file table has to grow, which several threads share. With --ramp-up or --idle gcannon grows it once, before the threads start.
Ramp steps
With --ramp-p99, the main thread steers the workers through a control word each one reads once per loop iteration, as the warmup’s reset already did: open the next step’s connections, zero the counters, or copy the stats out as a window closes. p99 is worked out from the merged copies once per step.
Kernel TLS
OpenSSL handles only the handshake. After it, the kernel encrypts and decrypts, so sends and receives stay ordinary io_uring operations on plaintext.
structure, from the README
main thread
  spawn N workers (warmup: >= 100ms and until every connection is set up;
                   reset stats, run for duration)
  --ramp-p99: per step, open the step's connections, warm up, reset stats,
              run for duration, have each worker copy its stats out, merge
              them and check p99; repeat until a step fails or -c
  --ramp-up, --idle: at each interval have the workers copy their stats out
              and zero them, and print a line; the workers open the rest of
              the connections over the ramp
  join, aggregate stats, print

worker thread
  io_uring ring + provided buffer ring
  for each connection: connect -> send(pipeline) -> recv -> count -> refill -> [reconnect]

How HttpArena runs it

gcannon is the load generator behind ten of the tests on HttpArena: its HTTP/1.1 throughput tests and all three of its WebSocket tests. HttpArena uses other generators for HTTP/2, HTTP/3, gRPC, its TLS tests and its fixed-rate tests. Every number on the front page is one of its published results, and these are the commands that produce them.

The commands

from HttpArena's scripts · each under taskset -c 32-63,96-127
# baseline
gcannon http://localhost:8080 --raw get.raw,post_cl.raw,post_chunked.raw -c 4096 -t 64 -d 5s -p 1
# pipelined
gcannon http://localhost:8080/pipeline -c 4096 -t 64 -d 5s -p 16
# short-lived
gcannon http://localhost:8080 --raw get.raw,post_cl.raw,post_chunked.raw -c 4096 -t 64 -d 5s -p 1 -r 10
# async
gcannon http://localhost:8080 --raw async-delay.raw -c 32000 -t 64 -d 10s -p 1
# WebSocket echo, pipelined, short-lived
gcannon http://localhost:8080/ws --ws -c 4096 -t 64 -d 5s -p 1
gcannon http://localhost:8080/ws --ws -c 4096 -t 64 -d 5s -p 16
gcannon http://localhost:8080/ws --ws -c 4096 -t 64 -d 5s -p 1 -r 10

The baseline templates

Byte for byte, with lines ending in CRLF. The connections rotate over a GET with a query, a POST with Content-Length and a chunked POST. The async template is GET /delay/10 HTTP/1.1 with Host: localhost:8080.

get.raw
GET /baseline11?a=13&b=42 HTTP/1.1
Host: localhost:8080
post_cl.raw
POST /baseline11?a=13&b=42 HTTP/1.1
Host: localhost:8080
Content-Length: 2

20
post_chunked.raw
POST /baseline11?a=13&b=42 HTTP/1.1
Host: localhost:8080
Transfer-Encoding: chunked

2
20
0

The bench host

Machine
AMD Ryzen Threadripper PRO 3995WX, 64 cores / 128 threads, 251 GiB RAM, Ubuntu 24.04.4 LTS, Linux 6.17, CPU governor performance.
gcannon's half
It runs natively on the host, pinned with taskset to CPUs 32-63 and 96-127: 32 cores and their SMT siblings, with -t 64.
The server's half
The server's container gets CPUs 0-31 and 64-95. Traffic goes over loopback to localhost:8080.
Runs
Each run lasts 5 s (10 s for async and async database). Each test runs three times and the best run is published.

What a published number means

It is what the server achieved under gcannon's load. gcannon generated, sent, parsed, counted and timed every one of those requests or frames, so it shows what gcannon sustains on 32 cores. It is not a measured ceiling of gcannon, since the server or the host may be the limit. The results don't record which gcannon version measured them.

The ten tests and their best published results as of 2026-11-16 are on the range card. HttpArena has its own page on gcannon.