Skip to content

Commit

Permalink
rename to ghz (#19)
Browse files Browse the repository at this point in the history
* rename to ghz

* rename to ghz
  • Loading branch information
bojand authored Jul 11, 2018
1 parent 198e664 commit cbe8ea6
Show file tree
Hide file tree
Showing 15 changed files with 449 additions and 45 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/

cmd/grpcannon/grpcannon
dist
cmd/ghz/ghz
dist
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
<br>
</div>

# grpcannon
# ghz

[![build status](https://img.shields.io/travis/bojand/grpcannon/master.svg?style=flat-square)](https://travis-ci.org/bojand/grpcannon)
[![Go Report Card](https://goreportcard.com/badge/github.com/bojand/grpcannon?style=flat-square)](https://goreportcard.com/report/github.com/bojand/grpcannon)
[![build status](https://img.shields.io/travis/bojand/ghz/master.svg?style=flat-square)](https://travis-ci.org/bojand/ghz)
[![Go Report Card](https://goreportcard.com/badge/github.com/bojand/ghz?style=flat-square)](https://goreportcard.com/report/github.com/bojand/ghz)

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)
![demo](ghz.gif)

## Install

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

## Usage

```
Usage: grpcannon [options...] <host>
Usage: ghz [options...] <host>
Options:
-proto The protocol buffer file.
-protoset The compiled protoset file. Alternative to proto. -proto takes precedence.
Expand Down Expand Up @@ -66,26 +66,26 @@ Options:
-v Print the version.
```

Alternatively all settings can be set via `grpcannon.json` file if present in the same path as the `grpcannon` executable. A custom configuration file can be specified using `-config` option.
Alternatively all settings can be set via `ghz.json` file if present in the same path as the `ghz` executable. A custom configuration file can be specified using `-config` option.

## Examples

A simple unary call:

```sh
grpcannon -proto ./greeter.proto -call helloworld.Greeter.SayHello -d '{"name":"Joe"}' 0.0.0.0:50051
ghz -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
ghz -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
ghz -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.
Expand All @@ -98,21 +98,21 @@ Create a protoset
protoc --proto_path=. --descriptor_set_out=bundle.protoset *.proto
```

And then use it as input to `grpcannon` with `-protoset` option:
And then use it as input to `ghz` with `-protoset` option:

```
./grpcannon -protoset ./bundle.protoset -call helloworld.Greeter.SayHello -d '{"name":"Bob"}' -n 1000 -c 10 0.0.0.0:50051
./ghz -protoset ./bundle.protoset -call helloworld.Greeter.SayHello -d '{"name":"Bob"}' -n 1000 -c 10 0.0.0.0:50051
```

Note that only one of `-proto` or `-protoset` options will be used. `-proto` takes precedence.

Using a custom config file:

```sh
grpcannon -config ./config.json
ghz -config ./config.json
```

Example `grpcannon.json`
Example `ghz.json`

```json
{
Expand Down
18 changes: 9 additions & 9 deletions cmd/grpcannon/main.go → cmd/ghz/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"strings"
"time"

"github.com/bojand/grpcannon"
"github.com/bojand/grpcannon/config"
"github.com/bojand/grpcannon/printer"
"github.com/bojand/grpcannon/protodesc"
"github.com/bojand/ghz"
"github.com/bojand/ghz/config"
"github.com/bojand/ghz/printer"
"github.com/bojand/ghz/protodesc"
"github.com/jhump/protoreflect/desc"
)

Expand Down Expand Up @@ -51,10 +51,10 @@ var (

v = flag.Bool("v", false, "Print the version.")

localConfigName = "grpcannon.json"
localConfigName = "ghz.json"
)

var usage = `Usage: grpcannon [options...] <host>
var usage = `Usage: ghz [options...] <host>
Options:
-proto The protocol buffer file.
-protoset The compiled protoset file. Alternative to proto. -proto takes precedence.
Expand Down Expand Up @@ -186,13 +186,13 @@ func usageAndExit(msg string) {
os.Exit(1)
}

func runTest(config *config.Config) (*grpcannon.Report, error) {
func runTest(config *config.Config) (*ghz.Report, error) {
mtd, err := getMethodDesc(config)
if err != nil {
return nil, err
}

opts := &grpcannon.Options{
opts := &ghz.Options{
Host: config.Host,
Cert: config.Cert,
CName: config.CName,
Expand All @@ -207,7 +207,7 @@ func runTest(config *config.Config) (*grpcannon.Report, error) {
Metadata: config.Metadata,
}

reqr, err := grpcannon.New(mtd, opts)
reqr, err := ghz.New(mtd, opts)
if err != nil {
return nil, err
}
Expand Down
Loading

0 comments on commit cbe8ea6

Please sign in to comment.