gRPC execution flow - architecture

52 views
Skip to first unread message

ankitpa...@gmail.com

unread,
Dec 11, 2018, 5:15:21 PM12/11/18
to grpc.io
Hi All

I have followed quick start tutorials on gRPC (Python and C++ version) and i want to explore more on gRPC and its use cases, which gRPC.io have pointers to.
I am also interested in learning how gRPC works in details including gRPC flow execution diagram and architecture.  https://grpc.io/docs/ doesnot have any information on this topic. 
can you point me to some docs, video link where inner workings of gRPC and protobuf are discussed? 

i also attempted looking at the source code on github but i feel overwhelmed. any pointers for start would be appreciated.

some specifics i like to understand are 

what happens step by from line 29 to 31? I can figure that client is making connection with server; sending a string using protobuf and receives response back
bu i am interested in learning as much details on what happens behind the curtain.

thanks
Ankit  


  

li...@google.com

unread,
Dec 11, 2018, 6:29:10 PM12/11/18
to grpc.io
Hi Ankit,

I'm glad to see your interest toward learning gRPC. There are two talk posted on https://grpc.io/docs/talks/ I would personally like to recommend to you:

* gRPC Intro - Jayant Kolhe, May 2018 
gRPC Deep Dive - Sree Kuchibhotla, May 2018

The gRPC Deep Dive will give you thorough idea of how gRPC is working under the hood.

For your question about the example, there are several specific gRPC only concepts in https://grpc.io/docs/guides/concepts.html. In the guide, there is a definition for stub:

> On the client side, the client has a local object known as stub (for some languages, the preferred term is client) that implements the same methods as the service. The client can then just call those methods on the local object, wrapping the parameters for the call in the appropriate protocol buffer message type - gRPC looks after sending the request(s) to the server and returning the server’s protocol buffer response(s).

Also, you may need to have a basic concept about what is ProtoBuf and what does it do.

If you got all the prerequisites, let's get to the code itself.
For line 29, it creates an insecure channel as client. It is using `with` semantics to conveniently close the channel after use. Alternatively, you can create the channel and assign it to an variable, then close it later.
For line 30, it creates an stub used to invoke RPC calls. It is imported from the generated code.
For line 31, it invoked an RPC with the ProtoBuf message instance and saved the response. It is also defined and imported by the proto file.

Feel free to ask further questions.

Cheers,
Lidi Zheng
Reply all
Reply to author
Forward
0 new messages