gRPC message size

Monday, Aug 21, 2017
go protobuf gRPC

What is gRPC?

A high performance, open-source universal RPC framework - https://grpc.io

RPC stands for Remote Procedure Call. gRPC is a framework that allows you to create RPC servers using protocol buffers for a variety of languages.

In distributed computing, a remote procedure call (RPC) is when a computer program causes a procedure (subroutine) to execute in a different address space (commonly on another computer on a shared network), which is coded as if it were a normal (local) procedure call, without the programmer explicitly coding the details for the remote interaction. - https://en.wikipedia.org/wiki/Remote_procedure_call

My problem

For a POC I was using gRPC to transfer a list of objects to the consumer. I was not aware that gRPC has a default limit of 4MB for a message. For a production environment the valid solution would be to split the result (pagination, etc.). For the proof of concept, I still wanted all objects transferred to the client.

Solution

The solution was to increase the MaxRecvMsgSize and the MaxSendMsgSize:

grpc.NewServer(grpc.MaxRecvMsgSize(math.MaxInt32), grpc.MaxSendMsgSize(math.MaxInt32))

Kudos to Johan Brandhorst for his help on Slack