Thanks! On Fri, Apr 26, 2019 at 6:34 PM Eric Anderson <[email protected]> wrote:
> Using individual RPCs for each message is fine. If, however, you are > trying to get better performance on the server (not in transfer rates, but > in processing rates), using a longer-lived bidi stream could be useful. > > As I discussed in my KubeCon talk > <https://kccna18.sched.com/event/GrWo/using-grpc-for-long-lived-and-streaming-rpcs-eric-anderson-google> > (slides > are near "PDF" and video is "link to session recording"), longer-lived bidi > streams are harder to use and open you to different problems. Long-lived > RPCs in particular can require special care. So make sure you are solving a > big enough problem by using such streams, so that you don't introduce > complexity for little gain. That isn't to say "don't use long-lived, bidi > streams." Long-lived, bidi streams are a life-saver in some cases. Just > make sure it is worth it. > > At the bare minimum, on the client you would need to manually handle the > bidi stream getting closed/killed, would likely want to enable keepalive, > and probably would also need acks back from the server. If you don't get an > ack for a message before the stream goes down, you'd have to re-send it. On > server-side, it is commonly good to close the connection occasionally to > spread load. It's easiest to send a response to the client asking it to > close the stream, so that you don't lose messages (when server closes, > messages the client sends will be lost). > > On Thu, Apr 25, 2019 at 10:43 PM tal bahalool <[email protected]> wrote: > >> Hi Eric, >> I have server that expose bidirectional method and i need to generate >> client that will send messages of max 5MB every 1-2 seconds. >> >> Currently i'm creating client, and saving the instance as a member in my >> class and then for each message i'm calling rpc bidi method. >> >> I wonder if i need to call the rpc bidi method once in start (process >> startup) and then save the full duplex instance as class member and when >> message arrive just to call to the "write" method and when process go down >> call "end". >> >> 1. what is the best practice in my case? performance issue >> 2. the connection to server start once when client created both cases? >> (just to be sure) >> >> ** i'm using javascript client >> Thanks! >> >> -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/grpc-io. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/CAFaSE%3DBRaiSriepnngY0js2ZicEpEVOAE61smREVrNf7ik5shg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
