You have an HTTP service and two questions about it: how many requests per second can it take, and what does the slow end of the latency look like? The average is rarely the interesting number. Users remember the request that took a second, so the numbers that matter are p99 and p99.9.

Most quick load tests work the same way. They open a fixed number of connections, and each connection sends a request, waits for the answer, and sends the next one. This is called the closed model. It is simple, and it has a blind spot: when the server freezes, the load tester freezes with it. It sends nothing during the stall, so it records almost nothing bad. The report looks clean exactly when the server behaved worst. This effect has a name, coordinated omission.

loadtest is an HTTP load tester in the spirit of wrk, wrk2 and oha, built on Tokio and hyper. It can run the closed model, or a fixed request rate (the open model) that does not hide server stalls. Latency goes into an HDR histogram, and you get percentiles up to p99.9, a status-code breakdown, error classes, a live terminal view while it runs and a JSON report at the end.

The README says who it is for: backend developers who want a single small binary to measure a local or staging HTTP service, and people curious about why closed-loop benchmarks lie about tail latency.

What it does

Two load models. By default, -c N connections send requests back to back until -n requests are done or the -z duration ends. Adding -q R sets a target rate in requests per second and switches to the open model. There, -c becomes the maximum number of requests in flight.

A full latency picture. Min, mean, standard deviation and max, then p50, p75, p90, p95, p99 and p99.9, plus a ten-bucket histogram in the text report.

Status codes and errors. Responses are counted per status code. Failures are classed by kind, for example timeout when a request passes the -t limit, or a refused connection.

A live view. In a terminal, a ratatui screen shows progress, requests per second (last second and overall), the current percentiles, status codes, errors and a requests-per-second sparkline. q, Esc or Ctrl-C stops early and still prints the report.

A JSON report. --json prints the same numbers as JSON, with the histogram buckets and a per-second timeline, and -o file writes it to a file. That makes it easy to keep results from a CI job or compare two runs.

Real requests. You can set the method (-m), headers (-H 'K: V'), a body (-d) or a body from a file (-D file).

How to use it

Install it from GitHub with Cargo:

cargo install --git https://github.com/AbdeldjalilChougui/loadtest --locked 

The repository includes a small target server as an example, so from a clone you can try everything locally:

cargo build --release cargo run --release --example hello_server -- 8080 & # a local target loadtest http://127.0.0.1:8080/ -n 50000 -c 50 # closed model, 50 connections loadtest http://127.0.0.1:8080/ -z 30s -q 2000 -c 200 # open model, 2000 req/s loadtest http://127.0.0.1:8080/api -m POST -H 'Content-Type: application/json' \ -d '{"x":1}' -n 1000 --json > report.json 

The flags, in short:

  • -n N or -z 30s: stop after N requests (default 200) or after a duration.
  • -c N: connections (closed) or max requests in flight (open), default 50.
  • -q R: target rate in requests per second, which switches to the open model.
  • -t 20s: per-request timeout, counted as the error timeout.
  • --json, -o file: JSON report on stdout and/or to a file.
  • --no-tui: no live view. It is also off when stdout is not a terminal.

Why the open model matters

The README has a demonstration that is worth repeating, because it is the reason the tool exists. The bundled hello_server has a /stall route that freezes for one second every five seconds.

Six seconds with one connection, closed model:

 min 0.088 mean 0.171 stdev 5.369 max 1001.983 p50 0.130 p75 0.159 p90 0.195 p95 0.218 p99 0.272 p99.9 1.550 

Six seconds at 200 requests per second, open model:

 min 0.287 mean 105.567 stdev 228.500 max 1000.959 p50 0.504 p75 4.053 p90 450.559 p95 702.975 p99 941.567 p99.9 996.863 

Both runs saw the one-second freeze: the max is about 1000 ms in each. But the closed run sent nothing while its only connection was stuck, so the freeze is a single sample out of 34,810 and p99 looks perfect at 0.272 ms. The open run kept its schedule, so every request that was due during a freeze waited, and p90, p95 and p99 show what users would actually have felt.

These numbers come from the README's own run with client and server on the same laptop. They say nothing about your service. What they show is the difference between the two models on the same server.

How it works

  • The runner uses one hyper_util pooled client. In the closed model, c tasks loop: send, read the whole body, record. In the open model, a dispatcher sleeps until start + i/rate and spawns request i. The request waits for one of c slots, and its latency is measured from the moment the dispatcher fired. So time spent waiting for a slot, which means the server is slow, counts. The dispatcher never waits for responses, which is how it keeps the schedule during a stall.
  • The stats are a mutex-protected hdrhistogram covering 1 µs to 1 hour with 3 significant digits, plus status and error counters, bytes and per-second completions.
  • The live view is redrawn every 100 ms from a snapshot and runs on its own thread.

Things to know

  • http:// only. No TLS, no HTTP/2, no HTTP/3.
  • One URL per run. No request files and no scripting.
  • The generator has limits. The open model spawns a task per request. At very high rates on one machine, the generator itself becomes the bottleneck and latencies climb. The README notes that on the author's laptop it holds 5,000 requests per second, but not 20,000.
  • What latency includes. Reading the full body is included, and so is connection setup for new connections. There is no warm-up phase and no per-phase breakdown (DNS, connect, time to first byte).
  • Recording takes a mutex per request, which the README describes as fine up to tens of thousands of requests per second.

What is tested. cargo test runs 5 unit tests (the recorder, the text and JSON report, histogram buckets adding up, duration parsing, and the TUI rendered into ratatui's TestBackend) and 8 integration tests against a local hyper server. Those check that exactly n requests reach the server, the status-code breakdown, that duration mode stops on time, that the open model hits its target rate, timeout and connection-refused classification, and that method, headers and body are sent. One test checks the main claim directly: the open model exposes a 500 ms stall that the closed model's p99 hides.

Why I built it

Because a load test that reports a good p99 while the server was frozen is worse than no load test: it gives you a number to trust. The closed model is the default in many tools and in most hand-written scripts, and its blind spot is not obvious until you see the two outputs side by side.

I wanted a small tool where the open model is one flag away, where latency is measured from the moment the request was dispatched and not from the moment a connection became free, and where a test in the repository proves the difference. The rest, the histogram, the live view and the JSON report, is what makes it comfortable to use every day on a local or staging service.

Get the code

The source, the example server and the tests are on GitHub: https://github.com/AbdeldjalilChougui/loadtest. It is MIT licensed. Point it only at services you own or are allowed to test.

Originally published at abdeldjalilchougui.biz.