Basic grpc question - Sync versus async c++ server

173 views
Skip to first unread message

Aggarwal Sre

unread,
Sep 20, 2022, 6:43:01 PM9/20/22
to grpc.io
Hi, 

I am trying to correct my understanding of sync versus async handling of the GRPC APIs  particularly w.r.t C++ server.


I am assuming the benefit of using async server is performance. In other words a server can serve more requests with less resource foot print. 

Secondly - it seems even if I use a sync server version, I can still call the Async version of an API using a c# grpc client. Wondering, how does this handling works? Does blocking of the call only happens on the client side, based on which version of API is called. 

If Async is called for a server using Sync version, is it just the API that might take longer to complete if the server is experiencing load?

I would help, if someone could correct my understanding.

Regards,
Vivek Aggarwal

Mark D. Roth

unread,
Sep 21, 2022, 5:29:19 PM9/21/22
to Aggarwal Sre, grpc.io
Yes, the main difference between the sync and async APIs is performance, both in terms of resources used (the sync API ties up threads while waiting for results, which can be avoided using the async API) and in terms of actual RPC performance (throughput, latency, etc).  For some performance best-practices, see https://grpc.io/docs/guides/performance/.

The choice of sync vs. async API has no effect on the wire protocol.  A client may choose the sync vs. async APIs, and a server may also choose the sync vs. async APIs, and no matter what either of them chooses, they will still be able to talk to each other.

I hope this info is helpful!

--
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 grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/CABsnPP%2BLGJiBDimHFiULU5RZPwDf26mO10Tc6iVZfwPYwv-U1g%40mail.gmail.com.


--
Mark D. Roth <ro...@google.com>
Software Engineer
Google, Inc.
Reply all
Reply to author
Forward
0 new messages