Smallest size of message in gRPC

Asked by At

I need to find out what is the average size of request in gRPC when Im sending a string to server and receiving a string from server?

I read somewhere it should be around 20 Bytes but what I see in Network Monitor app is that the request is above 500 Bytes. So is it the smallest possible size of a gRPC message size or what?

1 Answers

1
Peter Wishart On Best Solutions

For a single rpc, gRPC needs to do a few things:

  1. Establish HTTP/2
  2. (Optional) Establish TLS
  3. Exchange headers for the RPCs (size depends on schema)
  4. Exchange actual RPC messages (size depends on schema)
  5. Close connection

gRPC is meant to be used for many RPCs on a single connection so the smallest possible rpc message is really the bytes used for 4.

[Edit]

I checked and the minimum data exchanged for an rpc is over 500 bytes, in terms of raw IP packets.

I used the gRPC helloworld.proto, changed to send an int32.

Inspecting packets in Wireshark showed the following IP packet totals:

  • 1286 bytes to establish connection, exchange headers and do the first rpc
  • 564 bytes for each subsequent rpc
  • 176 bytes for client Shutdown

Of those 546 "minimum" bytes:

  • 67% was TCP/IP overhead (acknowledgements, packet headers)
  • 10% was "trailer" data sent after the rpc