What is the difference between blocking, async/non-blocking, and future-based stubs in gRPC?
Last updated
Blocking stub: waits on the calling thread for the result. Simplest, but supports only unary and server-streaming.
Async stub: delivers results via callbacks (
StreamObserver) and is the only one supporting client-streaming and bidi RPCs.Future stub: returns a
ListenableFutureimmediately for unary calls, ideal for running unary calls in parallel.
- https://grpc.io/blog/optimizing-grpc-part-1/
- https://grpc.github.io/grpc-java/javadoc/io/grpc/stub/package-summary.html
- https://grpc.io/docs/what-is-grpc/core-concepts/
- https://medium.com/@pankaj02/grpc-synchronous-and-asynchronous-unary-rpc-in-java-d48c8712b6e2
- https://www.vskills.in/interview-questions/grpc-interview-questions
- https://daily.dev/posts/so-you-want-to-optimize-grpc---part-1-yrb2p6d9t
- https://www.baeldung.com/java-grpc-streaming
- https://grpc.io/docs/languages/java/basics/