A golang generic benchmarking tool based mostly on Gil Tene's wrk2, only rewritten in go, and extended to allow running arbitrary protocols.
This fork includes significant improvements to the HTTP benchmarking capabilities:
- Enhanced command-line interface with support for HTTP method specification (
-m) - Custom header support (
-H "Key: Value") - Request body support (
-b) for POST/PUT operations - Improved error handling and status code validation
- Cleaner dependency injection pattern for benchmark parameters
- Detailed latency distribution reporting
- Rate limiting with coordinated omission handling
- Detailed latency statistics with HDR Histogram
- Multiple connection and thread support
- Configurable HTTP methods, headers, and body
- Timeout handling for requests
- Comprehensive error reporting
go install github.com/okamyuji/wrk3@latestwrk3 [options] <url>-c, --connections intConnections to keep open (default: 10)
-t, --threads intNumber of threads to use (default: 2)
-r, --rate floatTarget request rate in requests/sec (default: 10000)
-d, --duration durationDuration of test (default: 10s)
-T, --timeout durationSocket/request timeout (default: 0s)
-m, --method stringHTTP method (default: "GET")
-H, --header stringAdd header to request (can be specified multiple times)
-b, --body stringRequest body
--latencyPrint latency statistics
-v, --versionPrint version information
Basic benchmark with rate limiting:
wrk3 -c 10 -t 2 -r 100 -d 30s http://localhost:8080/Example of GET request:
A basic example of performing a GET request to the root path (/).
wrk3 -t 2 -c 10 -d 10s -r 100 http://localhost:8080/Example of POST request:
An example of performing a POST request to the /post path, setting the request body to "Hello, POST!".
wrk3 -t 2 -c 10 -d 10s -r 100 -m POST -b "Hello, POST!" http://localhost:8080/postBenchmark with custom headers and method:
wrk3 -c 50 -t 4 -H "Authorization: Bearer token" -m POST http://localhost:8080/postThe tool provides detailed statistics including:
- Request throughput
- Total requests processed
- Error count
- Latency distribution (when
--latencyis enabled) - Connection and thread counts
- Test duration
The test suite includes several key test cases:
- Basic HTTP benchmarking functionality
- Rate limiting verification
- High latency server handling
- Request error handling
- Result summarization
To run tests:
make test- Uses Go's
rate.Limiterfor precise request rate control - Implements HDR Histogram for accurate latency measurements
- Handles coordinated omission through event generation
- Supports concurrent connections through goroutines
- Provides comprehensive error handling and reporting
- Supports HTTP methods (
GET,POST,PUT,DELETE, etc.) - Supports custom HTTP headers
- Supports request body (
-boption) - Supports request timeout (
-Toption)
Apache License 2.0
Contributions are welcome! Please feel free to submit a Pull Request.