Skip to content

Repository files navigation

ab

A Go implementation of the Apache HTTP server benchmarking tool. Stress-test web servers with concurrent HTTP requests and get a performance summary.

Installation

git clone https://github.com/buihdk/ab.git
cd ab
go build -o ab

Usage

./ab [options] <url>

Options

FlagDefaultDescription
-n1Number of requests to perform
-c1Number of concurrent requests at a time
-s30Timeout in seconds per request
-t300Maximum seconds to spend benchmarking

Example

./ab -n 100 -c 20 -s 1 -t 10 https://example.com

Output

Each response is printed as it completes. When all requests finish (or the timelimit is reached), a JSON summary is printed:

{
"Hostname": "example.com",
"Port": "443",
"DocumentPath": "https://example.com",
"DocumentLength": 648,
"ConcurrencyLevel": 20,
"TimeTaken": 3200000000,
"CompletedRequests": 100,
"FailedRequests": 0,
"Non2xxResponses": 0,
"TotalTransferred": 64800,
"Rps": 31.25,
"TimePerRequest": 32000000,
"TransferRate": 19.78
}
  • TimeTaken and TimePerRequest are in nanoseconds
  • TransferRate is in KB/s
  • Rps and TransferRate are floats so slow endpoints do not round to zero
  • CompletedRequests counts requests that got a response
  • FailedRequests counts requests that did not receive a response
  • Non2xxResponses counts responses whose status was outside the 2xx range

Development

# Run tests
go test ./...
# Run a specific test
go test -run TestCheckLinkSuccess

License

Released under the MIT License.

About

A tool for benchmarking your apache http server

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages