-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can i set grpc message size #4192
Comments
Set the option in both server and client sides. |
How To Set the option in both server and client sides?would you please give an example? |
I see you're trying to set the gRPC message size limits in go-zero. The error you're getting ( You're on the right track with using
s := zrpc.MustNewServer(c.RpcServerConf, ...)
s.AddOptions(
grpc.MaxRecvMsgSize(maxMessageSize),
grpc.MaxSendMsgSize(maxMessageSize)
)
type Config struct {
zrpc.RpcServerConf
}
c.RpcServerConf.MaxMessageSize = 20 * 1024 * 1024 // Set to 20MB for example A few important notes:
For reference, here's a complete example: const maxMessageSize = 20 * 1024 * 1024 // 20MB
s := zrpc.MustNewServer(c.RpcServerConf,
func(grpcServer *grpc.Server) {
// Your service registrations...
userCenterClient.RegisterUserServiceServer(grpcServer, userserviceServer.NewUserServiceServer(ctx))
// ... other registrations ...
if c.Mode == service.DevMode || c.Mode == service.TestMode {
reflection.Register(grpcServer)
}
})
// Set both MaxRecvMsgSize and MaxSendMsgSize
s.AddOptions(
grpc.MaxRecvMsgSize(maxMessageSize),
grpc.MaxSendMsgSize(maxMessageSize)
) This should resolve your "ResourceExhausted" error while maintaining the rest of your server configuration. |
in rpc
The text was updated successfully, but these errors were encountered: