Why does gRPC uses Length Prefixed Messages?

Nikhil Jain

I am trying to understand how does gRPC sends stream messages using HTTP2 ? The link https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md says,

"The repeated sequence of Length-Prefixed-Message items is delivered in DATA frames"

My understanding from reading this statement is that each (protobuf) message is encapsulated by gRPC in a HTTP2 Data Frame and sent over. If thats so, then why do gRPC need to append Length Prefix to the message, can't it simply read the complete Data Frame Body and assume it to be one complete message ?

What am I missing here ?

Muxi

The missing part is that there is not guarantee that one DATA frame contains only one gRPC message. gRPC messages is a higher layer stream that works as payload for HTTP/2. It may be implemented in the way you described in the official gRPC libraries, but in terms of protocol it is totally valid to receive some DATA frame with more than one gRPC PDU.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Does gRPC resend messages

Why do Rust/sodiumoxide PublicKeys get prefixed with a length when serialised?

Why does extracting an archive in Flutter show files not in the archive that are prefixed with _.?

Why does the put and let statements need to be prefixed by a % sign in SAS

Why does android need showAsAction="always" to be prefixed with an alias?

Why GRPC uses HTTP2 instead of pure TCP?

Why gRPC Python does not see first field?

Why does this return a 0 length?

Why are some typeclasses prefixed with "Monad"?

Why is http.Client{} prefixed with &?

Why is the value prefixed with "Elixir."?

What does a prefixed asterisk mean

Why does sending consecutive UDP messages cause messages to arrive late?

Why this for loop of array uses newARRAY.length-1?

Iphone - Why does stream cut the long messages?

Why my Control does not catch MouseWheel messages?

Why does Java uses heap for memory allocation?

Why does continueWith uses action(of task) as a parameter?

Why does Coffeescript uses an additional variable in loops?

Why does Queue Uses LinkedList Constructor in Java

How and why does Express uses MVC pattern?

Why does Typescript uses 'number' instead of int'?

Why does connection profile in Hyperledger Fabric has gRPC URL?

GRPC - why does `CallInvoker` need to impose `TRequest: class` and `TResponse: class`?

Why does grpc-gateway is not building new endpoints

Why does a string of length 3 have 3 as its byte length?

Why does a string index in an array not increase the 'length'?

Why does a date length return Null?

Why does munmap needs a length as parameter?