How to increase message size in grpc using python

谁说我不能喝 提交于 2019-12-10 04:24:49

问题


I am using grpc for message passing and am testing a simple server and client. When my message size goes over the limit, I get this error.

grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with 
(StatusCode.INVALID_ARGUMENT,
 Received message larger than max (7309898 vs. 4194304))>

How do I increase the message size on the server and client side?


回答1:


Changing the message_length for both send and receive will do the trick.

channel = grpc.insecure_channel(
    'localhost:50051',
    options=[
        ('grpc.max_send_message_length', MAX_MESSAGE_LENGTH),
        ('grpc.max_receive_message_length', MAX_MESSAGE_LENGTH),
    ],
)



回答2:


You should not increase the message size.
It comes with a performance penalty.
In real situations one implements paging to split too large messages.



来源:https://stackoverflow.com/questions/42629047/how-to-increase-message-size-in-grpc-using-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!