Projects / abr

git clone https://molodetz.nl/retoor/abr.git

Files

<!-- 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

make # build optimized binary
make debug # build with debug symbols
make valgrind # run memory leak tests
make clean # remove build artifacts

Usage

./abr -n  -c  [-k] [-i] 

Python Version

Uses asyncio with aiohttp for concurrent HTTP requests.

Requirements

  • Python 3.7+
  • aiohttp

Install

make py-install

Usage

python3 abr.py -n  -c  [-k] [-i] 
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

./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

Files

  • Makefile 832 B raw
  • README.md 1.9 KB raw
  • abr.py 11.4 KB raw
  • main.c 41.3 KB raw
  • requirements.txt 15 B raw