grpc / grpc-web

gRPC for Web Clients
https://grpc.io
Apache License 2.0
8.56k stars 762 forks source link

Max Message Size #1182

Closed RohinBhargava closed 2 years ago

RohinBhargava commented 2 years ago

Can someone explain the max message size of a single request. It appears to be around 4 MB as per grpc specification. Can this limit be increased? Is there a configuration in either the grpc-web client that can be set or on the proxy (I am using envoy)? Thanks in advance.

sampajano commented 2 years ago

Hi! Thanks for the question! :)

We don't specifically set any size limit on the grpc-web client. Neither are we aware of any limit on the Envoy side.

The gRPC servers however, set their received request size limit to 4MB by default (e.g. the node server).

They should be configurable using grpc.max_receive_message_length, e.g. as mentioned here: https://www.npmjs.com/package/@grpc/grpc-js

and here: https://grpc.github.io/grpc/core/group__grpc__arg__keys.html#ga813f94f9ac3174571dd712c96cdbbdc1

On the node server, no max response size limit is set (I tried increasing the request size to 20MB in our interop test, which will still pass with an increased timeout).

Hope this answers your question. 😃

RohinBhargava commented 2 years ago

Thanks! Appreciate the response.

kyungseopk1m commented 9 months ago

I wrote it like this const server = new Server( { 'grpc.max_receive_message_length': 1024 * 1024 * 100, 'grpc.max_send_message_length': 1024 * 1024 * 100, } ); Grpc can attach up to 100MB to a single message.