yarpc / yab

Call and benchmark YARPC services from the command line.
MIT License
86 stars 35 forks source link

New: added gRPC streams support for benchmark - 5 #319

Closed jronak closed 3 years ago

jronak commented 3 years ago

Aim

Support gRPC streams in Yab

Changes

How to test?

Download grpc-stream-test-server.zip, follow the readme.md to run the test server and dispatch streaming yab queries

Bidi Stream

yab  --max-requests=10000 --max-duration=1s --timeout=1m -F testproto --service "test-server" --method uber.yarpc.encoding.protobuf.Test/Stream -p grpc://localhost:55555   -r '{"value": "1"}{"value": "2"}'
// Warmup response
{
  "value": "1"
}

{
  "value": "12"
}

Benchmark parameters:
  CPUs:            12
  Connections:     24
  Concurrency:     1
  Max requests:    10000
  Max duration:    1s
  Max RPS:         0
Latencies:
  0.5000: 922.41µs
  0.9000: 2.495403ms
  0.9500: 3.514855ms
  0.9900: 22.468952ms
  0.9990: 40.554458ms
  0.9995: 40.882234ms
  1.0000: 42.377369ms
Elapsed time (seconds):   0.74
Total requests:           10000
RPS:                      13558.80

STDIN mode

yab  --max-requests=10000 --max-duration=1s --timeout=1m -F testproto --service "test-server" --method uber.yarpc.encoding.protobuf.Test/Stream -p grpc://localhost:55555   -r '-'
{"value":"1"} // STDIN request-1
{
  "value": "1"
}

{"value":"2"} // STDIN request-2
{
  "value": "12"
}

Benchmark parameters:
  CPUs:            12
  Connections:     24
  Concurrency:     1
  Max requests:    10000
  Max duration:    1s
  Max RPS:         0
Latencies:
  0.5000: 625.964µs
  0.9000: 1.353507ms
  0.9500: 1.899145ms
  0.9900: 16.519147ms
  0.9990: 23.410829ms
  0.9995: 23.508979ms
  1.0000: 23.947096ms
Elapsed time (seconds):   0.43
Total requests:           10000
RPS:                      23259.32

Without Warmup

yab --max-requests=10000 --max-duration=1s --timeout=1m -F testproto --service "test-server" --method uber.yarpc.encoding.protobuf.Test/Stream -p grpc://localhost:55555   -r '{"value": "1"}{"value": "2"}' --warmup=0
Benchmark parameters:
  CPUs:            12
  Connections:     24
  Concurrency:     1
  Max requests:    10000
  Max duration:    1s
  Max RPS:         0
Latencies:
  0.5000: 696.727µs
  0.9000: 1.639929ms
  0.9500: 2.154043ms
  0.9900: 17.015733ms
  0.9990: 27.704704ms
  0.9995: 27.858184ms
  1.0000: 28.193725ms
Elapsed time (seconds):   0.48
Total requests:           10000
RPS:                      20980.48

Server Stream

yab  --max-requests=10000 --max-duration=1s --timeout=1m -F testproto --service "test-server" --method uber.yarpc.encoding.protobuf.Test/ServerStream -p grpc://localhost:55555   -r '{"value": "2"}'
{
  "value": "2"
}

Benchmark parameters:
  CPUs:            12
  Connections:     24
  Concurrency:     1
  Max requests:    10000
  Max duration:    1s
  Max RPS:         0
Latencies:
  0.5000: 606.604µs
  0.9000: 1.262325ms
  0.9500: 1.879435ms
  0.9900: 19.652758ms
  0.9990: 22.332575ms
  0.9995: 22.619429ms
  1.0000: 22.860896ms
Elapsed time (seconds):   0.44
Total requests:           10000
RPS:                      22716.25

Client Stream

yab --max-requests=10000 --max-duration=1s --timeout=1m -F testproto --service "test-server" --method uber.yarpc.encoding.protobuf.Test/ClientStream -p grpc://localhost:55555   -r '{"value": "a"}{"value": "b"}'
{
  "value": "2"
}

Benchmark parameters:
  CPUs:            12
  Connections:     24
  Concurrency:     1
  Max requests:    10000
  Max duration:    1s
  Max RPS:         0
Latencies:
  0.5000: 867.434µs
  0.9000: 1.94393ms
  0.9500: 2.652286ms
  0.9900: 13.673861ms
  0.9990: 21.272389ms
  0.9995: 21.932361ms
  1.0000: 23.618049ms
Elapsed time (seconds):   0.55
Total requests:           10000
RPS:                      18123.10

STDIN mode

yab --max-requests=10000 --max-duration=1s --timeout=1m -F testproto --service "test-server" --method uber.yarpc.encoding.protobuf.Test/ClientStream -p grpc://localhost:55555   -r '-'
{"value": "a"} // STDIN request-1
{"value": "b"} // STDIN request-2
{
  "value": "2"
}

Benchmark parameters:
  CPUs:            12
  Connections:     24
  Concurrency:     1
  Max requests:    10000
  Max duration:    1s
  Max RPS:         0
Latencies:
  0.5000: 783.716µs
  0.9000: 1.671911ms
  0.9500: 2.270289ms
  0.9900: 10.897964ms
  0.9990: 16.759355ms
  0.9995: 16.998659ms
  1.0000: 18.837755ms
Elapsed time (seconds):   0.46
Total requests:           10000
RPS:                      21630.18
codecov[bot] commented 3 years ago

Codecov Report

Merging #319 (6c34e4a) into dev (5394321) will decrease coverage by 0.02%. The diff coverage is 91.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #319      +/-   ##
==========================================
- Coverage   90.34%   90.31%   -0.03%     
==========================================
  Files          53       54       +1     
  Lines        2588     2644      +56     
==========================================
+ Hits         2338     2388      +50     
- Misses        177      180       +3     
- Partials       73       76       +3     
Impacted Files Coverage Δ
handler.go 79.87% <83.33%> (+0.27%) :arrow_up:
benchmark_stream.go 85.71% <85.71%> (ø)
bench_method.go 93.54% <100.00%> (ø)
bench_state.go 100.00% <100.00%> (ø)
benchmark.go 94.02% <100.00%> (+0.53%) :arrow_up:
benchmark_unary.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 5394321...6c34e4a. Read the comment docs.

jronak commented 3 years ago

@Dogild is suggesting to hold off this PR until #314, #315, #316, and #317 are merged. Might have to close and re-open this PR to merge into a different branch