Skip to content

Commit 3b6046c

Browse files
authored
Add README, CHANGES, tweak command line flags (#10)
1 parent 11969f2 commit 3b6046c

File tree

4 files changed

+82
-15
lines changed

4 files changed

+82
-15
lines changed

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.0.1
2+
3+
First release 🎈

README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# strest-grpc
2+
3+
Strest client and server implementations for gRPC.
4+
5+
## Running Locally
6+
7+
To run the client and server locally, first start the server.
8+
9+
```
10+
$ go run server/main.go
11+
starting gRPC server on :11111
12+
```
13+
14+
Next run the client. By default, the client will send as many request as it can
15+
on a single connection for 10 seconds, and exit with a performance report.
16+
17+
```
18+
$ go run client/main.go --address localhost:11111
19+
2017-05-12T16:17:40-07:00 98.2KB 354/0 10s L: 0 [ 89 97 ] 102 J: 0 0
20+
{
21+
"good": 354,
22+
"bad": 0,
23+
"bytes": 100556,
24+
"latency": {
25+
"50": 10,
26+
"95": 89,
27+
"99": 97,
28+
"999": 102
29+
},
30+
"jitter": {
31+
"50": 0,
32+
"95": 0,
33+
"99": 0,
34+
"999": 0
35+
}
36+
}
37+
```
38+
39+
### Flags
40+
41+
Use the `-help` flag with either the client or server to see a list of flags.
42+
43+
## Building
44+
45+
To build the client and server binaries, run:
46+
47+
```
48+
./bin/release.sh
49+
```
50+
51+
That will create `strest-client-linux` and `strest-server-linux` binaries in the
52+
root of the project.
53+
54+
To build a docker image, run:
55+
56+
```
57+
$ docker build -t buoyantio/strest-grpc:latest .
58+
```
59+
60+
Replace `latest` with whatever tag you are trying to build.
61+
62+
## Releasing
63+
64+
To release:
65+
66+
* Update and submit a PR with a changelog for the release in [CHANGES.md](CHANGES.md).
67+
* Merge the changelog PR.
68+
* Build the client and server binaries as described in the [Building](#building) section above.
69+
* Use Github to [create a new release](https://github.com/BuoyantIO/strest-grpc/releases/new).
70+
* Add the binaries that you built as attachments to the release.
71+
* The docker image is built automatically once the release is created.

client/main.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -452,17 +452,13 @@ func main() {
452452
latencyHist.Reset()
453453
jitterHist.Reset()
454454
timeout = time.After(*interval)
455-
if totalCount > 0 && totalCount > *totalRequests {
455+
if *totalRequests > 0 && totalCount > *totalRequests {
456456
cleanup <- struct{}{}
457457
}
458458
}
459459
}
460460
}()
461461

462462
wg.Wait()
463-
464-
if !*disableFinalReport {
465-
logFinalReport(totalGood, totalBad, totalBytes, globalLatencyHist, globalJitterHist)
466-
}
467463
os.Exit(0)
468464
}

server/main.go

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ import (
2222
"google.golang.org/grpc"
2323
)
2424

25-
const port = ":11111"
26-
2725
type server struct{}
2826

2927
var (
@@ -138,7 +136,9 @@ func (s *server) StreamingGet(stream pb.Responder_StreamingGetServer) error {
138136
}
139137

140138
func main() {
141-
help := flag.Bool("help", false, "show help message")
139+
rand.Seed(time.Now().UnixNano())
140+
141+
address := flag.String("address", ":11111", "hostname:port to serve on")
142142
metricAddr := flag.String("metric-addr", "", "address to serve metrics on")
143143

144144
flag.Usage = func() {
@@ -148,20 +148,17 @@ func main() {
148148

149149
flag.Parse()
150150

151-
if *help {
152-
flag.Usage()
153-
os.Exit(64)
154-
}
155-
156151
if *metricAddr != "" {
157152
registerMetrics()
158153
go func() {
159154
http.Handle("/metrics", promhttp.Handler())
160155
http.ListenAndServe(*metricAddr, nil)
161156
}()
162157
}
163-
rand.Seed(time.Now().UnixNano())
164-
lis, err := net.Listen("tcp", port)
158+
159+
fmt.Println("starting gRPC server on", *address)
160+
161+
lis, err := net.Listen("tcp", *address)
165162
if err != nil {
166163
log.Fatalf("failed to listen: %v", err)
167164
}

0 commit comments

Comments
 (0)