httpress
A fast, flexible HTTP benchmarking library and CLI tool built in Rust.
Features • Installation • Quick Start • Library Usage • CLI Usage • Examples
Features
- Simple Builder API - Fluent, type-safe configuration
- High Performance - Async Rust with minimal overhead
- Flexible Rate Control - Fixed rates or dynamic rate functions
- Custom Request Generation - Generate requests dynamically per-worker
- Hook System - Inject custom logic before/after requests
- Detailed Metrics - Latency percentiles, throughput, status codes
- Concurrent Workers - Configurable parallelism
- Adaptive Testing - Duration-based or request-count-based
- Retry Logic - Smart retry with hook-based control
- Library + CLI - Use as Rust library or standalone tool
Installation
As a Library
Add to your Cargo.toml:
[]
= "0.5"
= { = "1", = ["full"] }
As a CLI Tool
Quick Start
use Benchmark;
use Duration;
let results = builder
.url
.concurrency
.duration
.build?
.run
.await?;
results.print;
Library Usage
Basic Benchmark
let results = builder
.url
.concurrency
.requests
.build?
.run
.await?;
Custom Request Generation
.request_fn
Dynamic Rate Control
.rate_fn
Hook System
.after_request
For complete API documentation, see docs.rs/httpress.
CLI Usage
Basic Examples
# Run benchmark with 100 concurrent connections for 30 seconds
# Fixed number of requests with rate limiting
# POST request with headers and body
Options
| Flag | Description | Default |
|---|---|---|
-n, --requests |
Total number of requests | - |
-d, --duration |
Test duration (e.g. 10s, 1m) | - |
-c, --concurrency |
Concurrent connections | 10 |
-r, --rate |
Rate limit (req/s) | - |
-m, --method |
HTTP method | GET |
-H, --header |
HTTP header (repeatable) | - |
-b, --body |
Request body | - |
-t, --timeout |
Request timeout in seconds | 30 |
Example Output
Requests: 1000 total, 1000 success, 0 errors
Duration: 0.06s
Throughput: 16185.07 req/s
Latency:
Min: 245us
Max: 2.41ms
Mean: 612us
p50: 544us
p90: 955us
p95: 1.08ms
p99: 1.61ms
Status codes:
200: 1000
Examples
The examples/ directory contains:
- basic_benchmark.rs - Simple benchmark example
- custom_requests.rs - Dynamic request generation with request_fn
- rate_ramping.rs - Rate control with rate_fn
- hooks_metrics.rs - Custom metrics collection using hooks
Run examples with: