Doubt about "Next" API.

62 views
Skip to first unread message

karthik karra

unread,
Apr 17, 2022, 2:13:27 AM4/17/22
to grpc.io
Hi,

Context :

For the Async design, we use "Next" API with completion queue and this blocking in nature until an event happens.

In the description for "Next" API (https://grpc.github.io/grpc/cpp/classgrpc_1_1_completion_queue.html#a86d9810ced694e50f7987ac90b9f8c1a), its mentioned as if "ok" is true, then it means that data is going to go the wire.

so the moment ok is returned either with true or false, the "Next" API gets unblocked.

My Understanding:

Underneath GRPC we have many layers and GRPC being the top most layer.
GRPC <-> HTTP/2 <-> Regular Network Stack (TCP <-> IP <-> Ethernet <-> Physical Wire)
(Please correct if any of this assumption is wrong)

Doubt:

When the description is "Next" API says "...data going to wire" and returning either true or false for "ok" variable, what exactly does the wire means ? 
Is it after the GRPC layer or HTTP/2 layer or Physical wire itself or something else ?

Any insights would be helpful.

Thanks



 

yas...@google.com

unread,
May 1, 2023, 6:11:28 PM5/1/23
to grpc.io
Hi,

Wow, I forgot about replying to this. Apologies!
You are right in your assumptions. By default, "is going to go to the wire" just means that data has been accepted by the gRPC stack and that gRPC will try to write the data to the socket (or whatever transport mechanism is being used). From gRPC's HTTP/2 layer perspective, it means that HTTP/2 flow control succeeded on the message and that it will be sent to the TCP layer for further processing.

Also, please note that gRPC C++ is now recommending the use of new callback API, which is much easier to use.

Reply all
Reply to author
Forward
0 new messages