plow/README.md

166 lines
5.8 KiB
Markdown
Raw Normal View History

2021-06-20 17:58:10 +00:00
# plow <!-- omit in toc -->
[![build](https://github.com/six-ddc/plow/actions/workflows/release.yml/badge.svg)](https://github.com/six-ddc/plow/actions/workflows/release.yml)
[![Homebrew](https://img.shields.io/badge/dynamic/json.svg?url=https://formulae.brew.sh/api/formula/plow.json&query=$.versions.stable&label=homebrew)](https://formulae.brew.sh/formula/plow)
2021-06-22 14:19:11 +00:00
[![GitHub license](https://img.shields.io/github/license/six-ddc/plow.svg)](https://github.com/six-ddc/plow/blob/main/LICENSE)
[![made-with-Go](https://img.shields.io/badge/Made%20with-Go-1f425f.svg)](http://golang.org)
2021-06-22 14:19:11 +00:00
Plow is a HTTP(S) benchmarking tool, written in Golang. It uses
excellent [fasthttp](https://github.com/valyala/fasthttp#http-client-comparison-with-nethttp) instead of Go's default
net/http due to its lightning fast performance.
2021-06-22 14:19:11 +00:00
Plow runs at a specified connections(option `-c`) concurrently and **real-time** records a summary statistics, histogram
of execution time and calculates percentiles to display on Web UI and terminal. It can run for a set duration(
option `-d`), for a fixed number of requests(option `-n`), or until Ctrl-C interrupted.
2021-06-22 14:19:11 +00:00
The implementation of real-time computing Histograms and Quantiles using stream-based algorithms inspired
by [prometheus](https://github.com/prometheus/client_golang) with low memory and CPU bounds. so it's almost no
additional performance overhead for benchmarking.
2021-06-15 12:21:02 +00:00
![](https://github.com/six-ddc/plow/blob/main/demo.gif?raw=true)
```text
./plow http://127.0.0.1:8080/hello -c 20
Benchmarking http://127.0.0.1:8080/hello using 20 connection(s).
2021-06-27 03:16:36 +00:00
@ Real-time charts is listening on http://[::]:18888
Summary:
Elapsed 8.6s
Count 969657
2xx 776392
4xx 193265
RPS 112741.713
Reads 10.192MB/s
Writes 6.774MB/s
Statistics Min Mean StdDev Max
Latency 32µs 176µs 37µs 1.839ms
RPS 108558.4 112818.12 2456.63 115949.98
Latency Percentile:
P50 P75 P90 P95 P99 P99.9 P99.99
173µs 198µs 222µs 238µs 274µs 352µs 498µs
Latency Histogram:
141µs 273028 ■■■■■■■■■■■■■■■■■■■■■■■■
177µs 458955 ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
209µs 204717 ■■■■■■■■■■■■■■■■■■
235µs 26146 ■■
269µs 6029 ■
320µs 721
403µs 58
524µs 3
```
2021-06-20 17:58:10 +00:00
- [Installation](#installation)
2021-06-22 14:19:11 +00:00
- [Via Go](#via-go)
- [Via Homebrew](#via-homebrew)
- [Via Docker](#via-docker)
2021-06-20 17:58:10 +00:00
- [Usage](#usage)
2021-06-22 14:19:11 +00:00
- [Options](#options)
- [Examples](#examples)
- [Stargazers](#Stargazers)
- [License](#license)
2021-06-20 17:58:10 +00:00
## Installation
2021-06-22 14:19:11 +00:00
Binary and image distributions are available through the [releases](https://github.com/six-ddc/plow/releases)
assets page.
### Via Go
```bash
go install github.com/six-ddc/plow@latest
2021-06-20 11:40:18 +00:00
```
2021-06-22 14:19:11 +00:00
### Via Homebrew
```sh
2021-06-25 00:22:54 +00:00
# brew update
2021-06-22 14:19:11 +00:00
brew install plow
```
2021-06-20 11:40:18 +00:00
### Via Docker
```bash
docker run --rm --net=host ghcr.io/six-ddc/plow
# docker run --rm -p 18888:18888 ghcr.io/six-ddc/plow
```
## Usage
### Options
```bash
usage: plow [<flags>] <url>
A high-performance HTTP benchmarking tool with real-time web UI and terminal displaying
2021-06-27 03:16:36 +00:00
Examples:
plow http://127.0.0.1:8080/ -c 20 -n 100000
plow https://httpbin.org/post -c 20 -d 5m --body @file.json -T 'application/json' -m POST
Flags:
2021-06-27 03:16:36 +00:00
--help Show context-sensitive help.
-c, --concurrency=1 Number of connections to run concurrently
-n, --requests=-1 Number of requests to run
-d, --duration=DURATION Duration of test, examples: -d 10s -d 3m
-i, --interval=200ms Print snapshot result every interval, use 0 to print once at the end
--seconds Use seconds as time unit to print
2021-07-03 08:07:54 +00:00
-b, --body=BODY HTTP request body, if start the body with @, the rest should be a filename to read
2021-06-27 03:16:36 +00:00
--stream Specify whether to stream file specified by '--body @file' using chunked encoding or to read into memory
-m, --method="GET" HTTP method
-H, --header=K:V ... Custom HTTP headers
--host=HOST Host header
-T, --content=CONTENT Content-Type header
--cert=CERT Path to the client's TLS Certificate
--key=KEY Path to the client's TLS Certificate Private Key
-k, --insecure Controls whether a client verifies the server's certificate chain and host name
--listen=":18888" Listen addr to serve Web UI
--timeout=DURATION Timeout for each http request
--dial-timeout=DURATION Timeout for dial addr
--req-timeout=DURATION Timeout for full request writing
--resp-timeout=DURATION Timeout for full response reading
--socks5=ip:port Socks5 proxy
--auto-open-browser Specify whether auto open browser to show Web charts
2021-11-23 02:13:07 +00:00
--[no-]clean Clean the histogram bar once its finished. Default is true
2021-06-27 03:16:36 +00:00
--version Show application version.
Flags default values also read from env PLOW_SOME_FLAG, such as PLOW_TIMEOUT=5s equals to --timeout=5s
Args:
<url> request url
```
### Examples
Basic usage:
```bash
plow http://127.0.0.1:8080/ -c 20 -n 10000 -d 10s
```
POST a json file:
```bash
2021-06-25 00:22:54 +00:00
plow https://httpbin.org/post -c 20 --body @file.json -T 'application/json' -m POST
```
2021-07-03 08:07:54 +00:00
### Bash/ZSH Shell Completion
```bash
# Add the statement to their bash_profile (or equivalent):
eval "$(plow --completion-script-bash)"
# Or for ZSH
eval "$(plow --completion-script-zsh)"
```
2021-06-22 14:19:11 +00:00
## Stargazers
[![Stargazers over time](https://starchart.cc/six-ddc/plow.svg)](https://starchart.cc/six-ddc/plow)
## License
See [LICENSE](https://github.com/six-ddc/plow/blob/master/LICENSE).