problem: grpc upstream timeouts

solution: tune connection settings
This commit is contained in:
Igor Artamonov
2019-09-08 23:54:20 -04:00
parent 7fd27d581a
commit f0248c6cc0

View File

@@ -57,6 +57,8 @@ class GrpcUpstreams(
val channel: ManagedChannelBuilder<*> = if (auth != null && StringUtils.isNotEmpty(auth.ca)) { val channel: ManagedChannelBuilder<*> = if (auth != null && StringUtils.isNotEmpty(auth.ca)) {
NettyChannelBuilder.forAddress(host, port) NettyChannelBuilder.forAddress(host, port)
.useTransportSecurity() .useTransportSecurity()
.enableRetry()
.maxRetryAttempts(3)
.sslContext(withTls(auth)) .sslContext(withTls(auth))
} else { } else {
log.warn("Using insecure connection to $host:$port") log.warn("Using insecure connection to $host:$port")
@@ -67,7 +69,7 @@ class GrpcUpstreams(
val client = ReactorBlockchainGrpc.newReactorStub(channel.build()) val client = ReactorBlockchainGrpc.newReactorStub(channel.build())
this.client = client this.client = client
var i = 0 var i = 0
val grpcExecutor = Executors.newFixedThreadPool(32) { r -> Thread(r, "grpc-up-$id-${i++}") }; val grpcExecutor = Executors.newFixedThreadPool(64) { r -> Thread(r, "grpc-up-$id-${i++}") };
this.grpcTransport = EmeraldGrpcTransport.newBuilder() this.grpcTransport = EmeraldGrpcTransport.newBuilder()
.forChannel(client.channel) .forChannel(client.channel)
.setObjectMapper(objectMapper) .setObjectMapper(objectMapper)