<!-- 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)
### 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>
```
## 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