https://github.com/thiagonache/bench
An HTTP load tester and compare results tool.
https://github.com/thiagonache/bench
benchmark command-line-tool go golang
Last synced: 6 months ago
JSON representation
An HTTP load tester and compare results tool.
- Host: GitHub
- URL: https://github.com/thiagonache/bench
- Owner: thiagonache
- License: mit
- Created: 2022-04-01T11:47:05.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-07-23T13:12:00.000Z (almost 2 years ago)
- Last Synced: 2024-07-23T15:21:34.385Z (almost 2 years ago)
- Topics: benchmark, command-line-tool, go, golang
- Language: Go
- Homepage:
- Size: 134 KB
- Stars: 13
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bench
[](https://github.com/thiagonache/bench/actions/workflows/go.yml)
[](https://pkg.go.dev/github.com/thiagonache/bench)
[](https://goreportcard.com/report/github.com/thiagonache/bench)
An HTTP load tester and compare results tool.
## Import
```go
import "github.com/thiagonache/bench"
```
## Install binary
```shell
$ go install github.com/thiagonache/bench/cmd/simplebench@latest
$
```
## CLI
The CLI supports two sub commands, run or cmp.
### Run
Runs http benchmark and outputs the results to standard output.
It supports `any` HTTP method and several other configs.
```text
Usage of simplebench:
-b string
http body for the requests
-c int
number of concurrent requests (users) to run benchmark (default 1)
-g generate graphs
-m string
http method for the requests (default "GET")
-r int
number of requests to be performed in the benchmark (default 1)
-t string
requests content type header (default "text/html")
-u string
url to run benchmark
```
Examples:
- GET
```bash
$ simplebench run -r 20 -c 2 -u https://httpbin.org
Site: https://httpbin.org
Requests: 20
Successes: 20
Failures: 0
P50(ms): 150.359
P90(ms): 431.346
P99(ms): 761.359
```
- POST
```bash
$ simplebench run -m POST -t "application/json" -b '{"data":"abc"}' -r 20 -c 2 -u https://httpbin.org/post
Site: https://httpbin.org/post
Requests: 20
Successes: 20
Failures: 0
P50(ms): 143.970
P90(ms): 395.692
P99(ms): 574.325
```
- DELETE
```bash
$ simplebench run -m DELETE -r 20 -c 2 -u https://httpbin.org/delete
Site: https://httpbin.org/delete
Requests: 20
Successes: 20
Failures: 0
P50(ms): 145.996
P90(ms): 596.712
P99(ms): 640.887
```
### Cmp
It compares two executions and provide the difference.
```bash
$ simplebench run -r 10 -u https://httpbin.org/delay/2 > stats1.txt
$ simplebench run -r 10 -u https://httpbin.org/delay/1 > stats2.txt
$ simplebench cmp stats{1,2}.txt
Site: https://httpbin.org/delay/2
Metric Old New Delta Percentage
P50(ms) 2144.024 1146.673 -997.351 -46.52
P90(ms) 2221.990 1362.111 -859.879 -38.70
P99(ms) 2599.690 1613.528 -986.162 -37.93
```