Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial implementation #1

Merged
merged 56 commits into from
Apr 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
4d4d8a8
wip
bojand Mar 23, 2018
360a72e
wip
bojand Mar 24, 2018
5d09d05
wip
bojand Mar 24, 2018
a8e0006
started work on requestor
bojand Mar 24, 2018
0d8a80e
wip requestor
bojand Mar 25, 2018
025f2e6
wip
bojand Mar 26, 2018
5bae3ae
more code
bojand Mar 27, 2018
319772a
doReq:
bojand Mar 27, 2018
38f2465
wip
bojand Mar 28, 2018
5bc208e
wip
bojand Mar 28, 2018
6f14cf8
update grpc and simplify things
bojand Mar 28, 2018
d29beff
make stop channel be bool
bojand Mar 28, 2018
d5be5c1
wip
bojand Mar 28, 2018
9e6b6e5
comments
bojand Mar 28, 2018
a135e59
wip
bojand Mar 28, 2018
ac0f6f0
wip
bojand Mar 29, 2018
a7cf255
add cmd
bojand Mar 29, 2018
96a6d32
wip
bojand Mar 29, 2018
a46e6d5
add server streaming
bojand Mar 30, 2018
0f4a5ac
config tests
bojand Mar 30, 2018
a94d4de
wip
bojand Mar 31, 2018
fcfec8f
refactor payload creation
bojand Mar 31, 2018
16d0e0e
wip
bojand Mar 31, 2018
eed832d
add bidi
bojand Mar 31, 2018
c8fd461
TODO
bojand Mar 31, 2018
c9ac8c8
config and options refactor:
bojand Apr 3, 2018
e35b99c
add csv format
bojand Apr 3, 2018
94211ee
import paths
bojand Apr 3, 2018
dc22bd4
add dial timeout and keepalive time options
bojand Apr 4, 2018
1947e9c
todos
bojand Apr 4, 2018
3e5869a
update deps and add vendor
bojand Apr 4, 2018
199397b
cleanup and refactor
bojand Apr 4, 2018
078a9e9
wip
bojand Apr 4, 2018
0deabb9
refactor, tests and wip
bojand Apr 4, 2018
774d6c3
wip
bojand Apr 5, 2018
69094e3
add proto
bojand Apr 5, 2018
09806ee
remove redundant file open check
bojand Apr 5, 2018
536eb84
wip
bojand Apr 5, 2018
c3b6872
wip
bojand Apr 5, 2018
0dbe7fe
wip
bojand Apr 5, 2018
09ce600
wip
bojand Apr 5, 2018
9cb26d7
wip
bojand Apr 6, 2018
28b977b
version
bojand Apr 6, 2018
cebb712
releaser
bojand Apr 6, 2018
9ba2c1c
version flag
bojand Apr 6, 2018
ab60537
wip
bojand Apr 6, 2018
cb43092
readme
bojand Apr 6, 2018
5dbac98
readme
bojand Apr 6, 2018
57d43bb
add stats test
bojand Apr 6, 2018
4eca700
readme
bojand Apr 6, 2018
80fba57
comments
bojand Apr 6, 2018
dd7441e
goreleaser
bojand Apr 6, 2018
efd32e3
download
bojand Apr 6, 2018
329b974
readme
bojand Apr 7, 2018
b7de04b
improve config
bojand Apr 7, 2018
4546215
secure test
bojand Apr 7, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/

vendor
grpcannon
cmd/grpcannon/grpcannon
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
language: go
go:
- "1.10"
21 changes: 15 additions & 6 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

148 changes: 146 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,152 @@
# grpcannon
Playing with Go and gRPC

[![build status](https://img.shields.io/travis/bojand/grpcannon/master.svg?style=flat-square)](https://travis-ci.org/bojand/grpcannon)

Simple [gRPC](http://grpc.io/) benchmarking and load testing tool inspired by [hey](https://github.com/rakyll/hey/) and [grpcurl](https://github.com/fullstorydev/grpcurl).

## Demo

![demo](grpcannon.gif)

## Install

Download a prebuild executable binary from the [releases page](https://github.com/bojand/grpcannon/releases).

## Usage

```
./grpcannon -proto helloworld.proto -call helloworld.Greeter.SayHello -d '{"name":"Bob"}' localhost:50051
Usage: grpcannon [options...] <host>
Options:
-proto The protocol buffer file.
-call A fully-qualified method name in 'service/method' or 'service.method' format.
-cert The file containing the CA root cert file.

-c Number of requests to run concurrently. Total number of requests cannot
be smaller than the concurrency level. Default is 50.
-n Number of requests to run. Default is 200.
-q Rate limit, in queries per second (QPS). Default is no rate limit.
-t Timeout for each request in seconds. Default is 20, use 0 for infinite.
-z Duration of application to send requests. When duration is reached,
application stops and exits. If duration is specified, n is ignored.
Examples: -z 10s -z 3m.

-d The call data as stringified JSON.
-D Path for call data JSON file. For example, /home/user/file.json or ./file.json.
-m Request metadata as stringified JSON.
-M Path for call metadata JSON file. For example, /home/user/metadata.json or ./metadata.json.

-o Output path. If none provided stdout is used.
-O Output type. If none provided, a summary is printed.
"csv" is the only supported alternative. Dumps the response
metrics in comma-separated values format.

-i Comma separated list of proto import paths. The current working directory and the directory
of the protocol buffer file are automatically added to the import list.

-T Connection timeout in seconds for the initial connection dial. Default is 10.
-L Keepalive time in seconds. Only used if present and above 0.

-cpus Number of used cpu cores. (default for current machine is 8 cores)

-v Print the version.
```

Alternatively all settings can be set via `grpcannon.json` file if present in the same path as the `grpcannon` executable.

## Examples

A simple unary call:

```sh
grpcannon -proto ./greeter.proto -call helloworld.Greeter.SayHello -d '{"name":"Joe"}' 0.0.0.0:50051
```

Custom number of requests and concurrency:

```sh
grpcannon -proto ./greeter.proto -call helloworld.Greeter.SayHello -d '{"name":"Joe"}' -n 2000 -c 20 0.0.0.0:50051
```

Client streaming data can be sent as an array, each element representing a single message:

```sh
grpcannon -proto ./greeter.proto -call helloworld.Greeter.SayHelloCS -d '[{"name":"Joe"},{"name":"Kate"},{"name":"Sara"}]' 0.0.0.0:50051
```

If a single object is given for data it is sent as every message.

Example `grpcannon.json`

```json
{
"proto": "/path/to/greeter.proto",
"call": "helloworld.Greeter.SayHello",
"n": 2000,
"c": 50,
"d": {
"name": "Joe"
},
"i": [
"/path/to/protos"
]
}
```

## Output

Sample standard output of summary of the results:

```
Summary:
Count: 2000
Total: 345.52 ms
Slowest: 15.41 ms
Fastest: 0.66 ms
Average: 6.83 ms
Requests/sec: 5788347.22

Response time histogram:
0.664 [1] |
2.138 [36] |∎
3.613 [14] |
5.087 [65] |∎∎
6.561 [1305] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
8.035 [274] |∎∎∎∎∎∎∎∎
9.509 [66] |∎∎
10.983 [0] |
12.458 [59] |∎∎
13.932 [130] |∎∎∎∎
15.406 [50] |∎∎

Latency distribution:
10% in 5.18 ms
25% in 5.51 ms
50% in 6.10 ms
75% in 6.72 ms
90% in 12.19 ms
95% in 13.26 ms
99% in 14.73 ms
Status code distribution:
[OK] 2000 responses
```

Alternatively with `-O csv` flag we can get detailed listing in csv format:

```sh
duration (ms),status,error
1.43,OK,
0.39,OK,
0.36,OK,
0.50,OK,
0.36,OK,
0.40,OK,
0.37,OK,
0.34,OK,
0.35,OK,
0.32,OK,
...
```

## License

Apache-2.0
Loading