Skip to content
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

Grpc max message size support config by user. #564

Merged
merged 6 commits into from
Apr 4, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ private ManagedChannel getChannel(final Endpoint endpoint) {
final ManagedChannel ch = ManagedChannelBuilder.forAddress(ep.getIp(), ep.getPort()) //
.usePlaintext() //
.directExecutor() //
.maxInboundMessageSize(GrpcRaftRpcFactory.RPC_MAX_INBOUND_MESSAGE_SIZE) //
.build();
// channel connection event
ch.notifyWhenStateChanged(ConnectivityState.READY, () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ public class GrpcRaftRpcFactory implements RaftRpcFactory {
"grpc.default_rpc_server_processor_pool_size",
100);

static final int RPC_MAX_INBOUND_MESSAGE_SIZE = SystemPropertyUtil.getInt(
"grpc.max_inbound_message_size.bytes",
4 * 1024 * 1024);

static final RpcResponseFactory RESPONSE_FACTORY = new GrpcResponseFactory();

final Map<String, Message> parserClasses = new ConcurrentHashMap<>();
Expand Down Expand Up @@ -86,6 +90,7 @@ public RpcServer createRpcServer(final Endpoint endpoint, final ConfigHelper<Rpc
final Server server = ServerBuilder.forPort(port) //
.fallbackHandlerRegistry(handlerRegistry) //
.directExecutor() //
.maxInboundMessageSize(RPC_MAX_INBOUND_MESSAGE_SIZE) //
.build();
final RpcServer rpcServer = new GrpcServer(server, handlerRegistry, this.parserClasses, getMarshallerRegistry());
if (helper != null) {
Expand Down