1

I'm using gRPC to send messages from Java to a Python service. Recently I started getting larger messages that sometimes exceed the maximum message size for gRPC. Increasing that size is not possible for me due to lack of resources and timeouts, so I had to implement a chunking mechanism in order to split the large messages.

In Java, I check the message size using getSerializedSize() and if it exceeds the maximum size, I do the chunking. However, I noticed that the value I'm getting from getSerializedSize() is different and much smaller than the one shown in the error "gRPC message exceeds maximum size" which means that I still send messages that exhaust the resources.

For example, how is it possible that getSerializedSize() returns 75274 and the error shows a size of 179651? Both are supposed to show the size in bytes. I also tried getting the size using the length of the byte array, but it is identical to getSerializedSize().

How can I know the actual size gRPC will get before sending the message so I can apply the chunking when I should?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.