Skip to content

okamyuji/wrk3

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wrk3

Build Status Coverage Status Go Report Card Godocs

A golang generic benchmarking tool based mostly on Gil Tene's wrk2, only rewritten in go, and extended to allow running arbitrary protocols.

Recent Updates

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

Features

  • 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

Installation

go install github.com/okamyuji/wrk3@latest

Usage

wrk3 [options] <url>

Command Line Options

-c, --connections int

Connections to keep open (default: 10)

-t, --threads int

Number of threads to use (default: 2)

-r, --rate float

Target request rate in requests/sec (default: 10000)

-d, --duration duration

Duration of test (default: 10s)

-T, --timeout duration

Socket/request timeout (default: 0s)

-m, --method string

HTTP method (default: "GET")

-H, --header string

Add header to request (can be specified multiple times)

-b, --body string

Request body

--latency

Print latency statistics

-v, --version

Print version information

Examples

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

Benchmark with custom headers and method:

wrk3 -c 50 -t 4 -H "Authorization: Bearer token" -m POST http://localhost:8080/post

Output

The tool provides detailed statistics including:

  • Request throughput
  • Total requests processed
  • Error count
  • Latency distribution (when --latency is enabled)
  • Connection and thread counts
  • Test duration

Testing

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

Implementation Details

  • Uses Go's rate.Limiter for 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 (-b option)
  • Supports request timeout (-T option)

License

Apache License 2.0

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

A golang generic benchmarking tool based mostly on Gil Tene's wrk2, only rewritten in go, and extended to allow running arbitrary protocols

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Go 98.4%
  • Makefile 1.6%