2025-12-12 23:11:12 +00:00
|
|
|
<!-- retoor <retoor@molodetz.nl> -->
|
|
|
|
|
|
|
|
|
|
# abr
|
|
|
|
|
|
|
|
|
|
HTTP benchmark tool inspired by ApacheBench. Available in C and Python implementations.
|
|
|
|
|
|
|
|
|
|
## C Version
|
|
|
|
|
|
|
|
|
|
Uses non-blocking sockets with poll() multiplexing and OpenSSL for TLS.
|
|
|
|
|
|
|
|
|
|
### Requirements
|
|
|
|
|
|
|
|
|
|
- GCC
|
|
|
|
|
- OpenSSL development libraries (libssl-dev)
|
|
|
|
|
- POSIX-compliant system (Linux, BSD, macOS)
|
2026-09-08 06:43:57 +00:00
|
|
|
- A UTF-8 capable terminal for the charts (block and box-drawing characters)
|
2025-12-12 23:11:12 +00:00
|
|
|
|
|
|
|
|
### Build
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
make # build optimized binary
|
|
|
|
|
make debug # build with debug symbols
|
|
|
|
|
make valgrind # run memory leak tests
|
|
|
|
|
make clean # remove build artifacts
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
./abr -n <requests> -c <concurrency> [-k] [-i] <url>
|
|
|
|
|
```
|
|
|
|
|
|
2026-09-08 06:43:57 +00:00
|
|
|
### Output
|
|
|
|
|
|
|
|
|
|
abr prints a key/value summary (target, result, connection times, percentiles)
|
|
|
|
|
followed by four column charts, all drawn in the same style: a labelled y-axis
|
|
|
|
|
starting at zero, a baseline, and a labelled x-axis.
|
|
|
|
|
|
|
|
|
|
- **Throughput over time** — completed requests per second per time slice;
|
|
|
|
|
failures stack on top of each column in red
|
|
|
|
|
- **Response time over time** — mean response time per time slice
|
|
|
|
|
- **Response time distribution** — how the response times are spread
|
|
|
|
|
- **Response time percentiles** — p50 through p100, tail (p95+) highlighted
|
|
|
|
|
|
|
|
|
|
Charts size themselves to the terminal width. Colour and the live progress bar
|
|
|
|
|
are used only when stdout is a terminal, so `./abr ... > report.txt` produces
|
|
|
|
|
plain, greppable text with no escape codes.
|
|
|
|
|
|
2025-12-12 23:11:12 +00:00
|
|
|
## Python Version
|
|
|
|
|
|
|
|
|
|
Uses asyncio with aiohttp for concurrent HTTP requests.
|
|
|
|
|
|
|
|
|
|
### Requirements
|
|
|
|
|
|
|
|
|
|
- Python 3.7+
|
|
|
|
|
- aiohttp
|
|
|
|
|
|
|
|
|
|
### Install
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
make py-install
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
python3 abr.py -n <requests> -c <concurrency> [-k] [-i] <url>
|
|
|
|
|
make py-run # quick test run
|
|
|
|
|
make py-test # test with more requests
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Options
|
|
|
|
|
|
|
|
|
|
| Option | Description |
|
|
|
|
|
|--------|-------------|
|
|
|
|
|
| `-n` | Total number of requests |
|
|
|
|
|
| `-c` | Concurrent connections (max 10000) |
|
|
|
|
|
| `-k` | Enable HTTP Keep-Alive |
|
|
|
|
|
| `-i` | Skip SSL certificate verification |
|
|
|
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
./abr -n 1000 -c 50 -k https://example.com/
|
|
|
|
|
python3 abr.py -n 1000 -c 50 -k https://example.com/
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Output
|
|
|
|
|
|
|
|
|
|
- Requests per second
|
|
|
|
|
- Transfer rate (KB/s)
|
|
|
|
|
- Response time percentiles (50th, 66th, 75th, 80th, 90th, 95th, 98th, 99th)
|
|
|
|
|
- Connection time statistics (min, mean, median, max, standard deviation)
|
|
|
|
|
|
|
|
|
|
## Technical Details
|
|
|
|
|
|
|
|
|
|
### C Version
|
|
|
|
|
|
|
|
|
|
- Event-driven architecture using poll()
|
|
|
|
|
- Connection pooling with keep-alive support
|
|
|
|
|
- Chunked transfer-encoding support
|
|
|
|
|
- IPv4 and IPv6 via getaddrinfo()
|
|
|
|
|
- 30-second per-request timeout
|
|
|
|
|
- Graceful shutdown on SIGINT/SIGTERM
|
|
|
|
|
- OpenSSL 1.0.x and 1.1+ compatibility
|
|
|
|
|
- Memory leak free (verified with valgrind)
|
|
|
|
|
|
|
|
|
|
### Python Version
|
|
|
|
|
|
|
|
|
|
- Async I/O with asyncio and aiohttp
|
|
|
|
|
- Connection pooling with keep-alive support
|
|
|
|
|
- 30-second per-request timeout
|
|
|
|
|
- Graceful shutdown on SIGINT/SIGTERM
|