yarpc / yab

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

Delay client send stream closure #336

Closed jronak closed 3 years ago

jronak commented 3 years ago

Adds option stream-delay-close-send which accepts time duration to delay the closure of the send stream in the client streaming, and bidirectional streaming methods.

Currently, Yab closes the send stream once all the client requests have been dispatched which causes certain bidirectional streaming servers to stop the stream entirely. With this option, once all the client requests have been dispatched we can delay the closure of send stream.

This is particularly useful for Adhoc requests where servers stop sending the messages once send stream is closed.

For example, the client opens a bidirectional stream to watch the user activity of two users. But the server closes the stream if the client-side send stream is stopped.

Earlier:

yab --timeout=1m  --service "test-service" --method uber.yarpc.encoding.protobuf.Test/Stream -p grpc://localhost:5555   -r '{"watch": "user-1"} {"watch": "user-2"}'

// server doesn't send any message as the client has ended the send stream after sending the above two messages.

Now:

yab --timeout=1m  --service "test-service" --method uber.yarpc.encoding.protobuf.Test/Stream -p grpc://localhost:5555   -r '{"watch": "user-1"} {"watch": "user-2"}' --stream-delay-close-send=1m

{"user": "user-1", "activity": "LOGIN"}
.
.
.
// server continues to stream responses until send stream is open
codecov[bot] commented 3 years ago

Codecov Report

Merging #336 (91e242d) into dev (28df925) will increase coverage by 0.03%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #336      +/-   ##
==========================================
+ Coverage   90.26%   90.30%   +0.03%     
==========================================
  Files          54       54              
  Lines        2702     2712      +10     
==========================================
+ Hits         2439     2449      +10     
  Misses        184      184              
  Partials       79       79              
Impacted Files Coverage Δ
options.go 93.54% <ø> (ø)
handler.go 82.41% <100.00%> (+1.51%) :arrow_up:
protobuf/source_reflection.go 96.22% <0.00%> (-3.78%) :arrow_down:

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 28df925...91e242d. Read the comment docs.