fix: adjust grpc keepalive parameters

This commit is contained in:
Karol Sójko 2024-01-02 10:54:07 +01:00
parent 664a92132b
commit 5987b0899c
No known key found for this signature in database
GPG key ID: C2F813669419D05F
3 changed files with 9 additions and 7 deletions

View file

@ -152,7 +152,7 @@ export class ContainerConfigLoader {
container.bind(TYPES.ApiGateway_SYNCING_SERVER_GRPC_URL).toConstantValue(env.get('SYNCING_SERVER_GRPC_URL'))
const grpcAgentKeepAliveTimeout = env.get('GRPC_AGENT_KEEP_ALIVE_TIMEOUT', true)
? +env.get('GRPC_AGENT_KEEP_ALIVE_TIMEOUT', true)
: 8_000
: 20_000
const grpcMaxMessageSize = env.get('GRPC_MAX_MESSAGE_SIZE', true)
? +env.get('GRPC_MAX_MESSAGE_SIZE', true)
@ -163,7 +163,6 @@ export class ContainerConfigLoader {
container.get<string>(TYPES.ApiGateway_AUTH_SERVER_GRPC_URL),
grpc.credentials.createInsecure(),
{
'grpc.keepalive_time_ms': grpcAgentKeepAliveTimeout * 2,
'grpc.keepalive_timeout_ms': grpcAgentKeepAliveTimeout,
'grpc.default_compression_algorithm': grpc.compressionAlgorithms.gzip,
'grpc.default_compression_level': 2,
@ -177,7 +176,6 @@ export class ContainerConfigLoader {
container.get<string>(TYPES.ApiGateway_SYNCING_SERVER_GRPC_URL),
grpc.credentials.createInsecure(),
{
'grpc.keepalive_time_ms': grpcAgentKeepAliveTimeout * 2,
'grpc.keepalive_timeout_ms': grpcAgentKeepAliveTimeout,
'grpc.default_compression_algorithm': grpc.compressionAlgorithms.gzip,
'grpc.default_compression_level': 2,

View file

@ -84,16 +84,18 @@ void container.load().then((container) => {
serverInstance.keepAliveTimeout = httpKeepAliveTimeout
const grpcKeepAliveTime = env.get('GRPC_KEEP_ALIVE_TIME', true) ? +env.get('GRPC_KEEP_ALIVE_TIME', true) : 7_200_000
const grpcKeepAliveTimeout = env.get('GRPC_KEEP_ALIVE_TIMEOUT', true)
? +env.get('GRPC_KEEP_ALIVE_TIMEOUT', true)
: 10_000
: 20_000
const grpcMaxMessageSize = env.get('GRPC_MAX_MESSAGE_SIZE', true)
? +env.get('GRPC_MAX_MESSAGE_SIZE', true)
: 1024 * 1024 * 50
const grpcServer = new grpc.Server({
'grpc.keepalive_time_ms': grpcKeepAliveTimeout * 2,
'grpc.keepalive_time_ms': grpcKeepAliveTime,
'grpc.keepalive_timeout_ms': grpcKeepAliveTimeout,
'grpc.default_compression_algorithm': grpc.compressionAlgorithms.gzip,
'grpc.max_receive_message_length': grpcMaxMessageSize,

View file

@ -85,16 +85,18 @@ void container.load().then((container) => {
serverInstance.keepAliveTimeout = keepAliveTimeout
const grpcKeepAliveTime = env.get('GRPC_KEEP_ALIVE_TIME', true) ? +env.get('GRPC_KEEP_ALIVE_TIME', true) : 7_200_000
const grpcKeepAliveTimeout = env.get('GRPC_KEEP_ALIVE_TIMEOUT', true)
? +env.get('GRPC_KEEP_ALIVE_TIMEOUT', true)
: 10_000
: 20_000
const grpcMaxMessageSize = env.get('GRPC_MAX_MESSAGE_SIZE', true)
? +env.get('GRPC_MAX_MESSAGE_SIZE', true)
: 1024 * 1024 * 50
const grpcServer = new grpc.Server({
'grpc.keepalive_time_ms': grpcKeepAliveTimeout * 2,
'grpc.keepalive_time_ms': grpcKeepAliveTime,
'grpc.keepalive_timeout_ms': grpcKeepAliveTimeout,
'grpc.default_compression_algorithm': grpc.compressionAlgorithms.gzip,
'grpc.max_receive_message_length': grpcMaxMessageSize,