From cedae40c15bad48ccfc1788f921f77d06dba484d Mon Sep 17 00:00:00 2001 From: Ratnakar Date: Thu, 10 Aug 2023 09:18:19 -0400 Subject: [PATCH] reduce keepalive interval to avoid connection issues on VPC (#127) https://github.com/hyperledger-labs/fabric-operator/issues/126 Signed-off-by: asararatnakar --- defaultconfig/orderer/orderer.yaml | 3 ++- defaultconfig/orderer/v2/orderer.yaml | 3 ++- defaultconfig/orderer/v24/orderer.yaml | 3 ++- defaultconfig/orderer/v25/orderer.yaml | 3 ++- defaultconfig/peer/core.yaml | 9 ++++++--- defaultconfig/peer/v2/core.yaml | 9 ++++++--- defaultconfig/peer/v25/core.yaml | 9 ++++++--- pkg/offering/base/orderer/override/deployment.go | 3 +++ pkg/offering/base/peer/override/deployment.go | 5 +++++ 9 files changed, 34 insertions(+), 13 deletions(-) diff --git a/defaultconfig/orderer/orderer.yaml b/defaultconfig/orderer/orderer.yaml index 1c22dd84..160e3c08 100644 --- a/defaultconfig/orderer/orderer.yaml +++ b/defaultconfig/orderer/orderer.yaml @@ -56,7 +56,8 @@ General: # ServerMinInterval is the minimum permitted time between client pings. # If clients send pings more frequently, the server will # disconnect them. - ServerMinInterval: 60s + ## Changing defaults to 25s to fix connection issues with VPC clusters + ServerMinInterval: 25s # ServerInterval is the time between pings to clients. ServerInterval: 7200s # ServerTimeout is the duration the server waits for a response from diff --git a/defaultconfig/orderer/v2/orderer.yaml b/defaultconfig/orderer/v2/orderer.yaml index b4963637..49ca8a8c 100644 --- a/defaultconfig/orderer/v2/orderer.yaml +++ b/defaultconfig/orderer/v2/orderer.yaml @@ -46,7 +46,8 @@ General: # ServerMinInterval is the minimum permitted time between client pings. # If clients send pings more frequently, the server will # disconnect them. - ServerMinInterval: 60s + ## Changing defaults to 25s to fix connection issues with VPC clusters + ServerMinInterval: 25s # ServerInterval is the time between pings to clients. ServerInterval: 7200s # ServerTimeout is the duration the server waits for a response from diff --git a/defaultconfig/orderer/v24/orderer.yaml b/defaultconfig/orderer/v24/orderer.yaml index 82da297b..3b02a4ff 100644 --- a/defaultconfig/orderer/v24/orderer.yaml +++ b/defaultconfig/orderer/v24/orderer.yaml @@ -46,7 +46,8 @@ General: # ServerMinInterval is the minimum permitted time between client pings. # If clients send pings more frequently, the server will # disconnect them. - ServerMinInterval: 60s + ## Changing defaults to 25s to fix connection issues with VPC clusters + ServerMinInterval: 25s # ServerInterval is the time between pings to clients. ServerInterval: 7200s # ServerTimeout is the duration the server waits for a response from diff --git a/defaultconfig/orderer/v25/orderer.yaml b/defaultconfig/orderer/v25/orderer.yaml index 9177ed79..2a8240b5 100644 --- a/defaultconfig/orderer/v25/orderer.yaml +++ b/defaultconfig/orderer/v25/orderer.yaml @@ -46,7 +46,8 @@ General: # ServerMinInterval is the minimum permitted time between client pings. # If clients send pings more frequently, the server will # disconnect them. - ServerMinInterval: 60s + ## Changing defaults to 25s to fix connection issues with VPC clusters + ServerMinInterval: 25s # ServerInterval is the time between pings to clients. ServerInterval: 7200s # ServerTimeout is the duration the server waits for a response from diff --git a/defaultconfig/peer/core.yaml b/defaultconfig/peer/core.yaml index 7a0b771d..7109ec9b 100644 --- a/defaultconfig/peer/core.yaml +++ b/defaultconfig/peer/core.yaml @@ -63,13 +63,15 @@ peer: # MinInterval is the minimum permitted time between client pings. # If clients send pings more frequently, the peer server will # disconnect them - minInterval: 60s + ## Changing defaults to 25s to fix connection issues with VPC clusters + minInterval: 25s # Client keepalive settings for communicating with other peer nodes client: # Interval is the time between pings to peer nodes. This must # greater than or equal to the minInterval specified by peer # nodes - interval: 60s + ## Changing defaults to 30s to fix connection issues with VPC clusters + interval: 30s # Timeout is the duration the client waits for a response from # peer nodes before closing the connection timeout: 20s @@ -79,7 +81,8 @@ peer: # Interval is the time between pings to ordering nodes. This must # greater than or equal to the minInterval specified by ordering # nodes. - interval: 60s + ## Changing defaults to 30s to fix connection issues with VPC clusters + interval: 30s # Timeout is the duration the client waits for a response from # ordering nodes before closing the connection timeout: 20s diff --git a/defaultconfig/peer/v2/core.yaml b/defaultconfig/peer/v2/core.yaml index 45d3f32a..9fc821c6 100644 --- a/defaultconfig/peer/v2/core.yaml +++ b/defaultconfig/peer/v2/core.yaml @@ -81,13 +81,15 @@ peer: # MinInterval is the minimum permitted time between client pings. # If clients send pings more frequently, the peer server will # disconnect them - minInterval: 60s + ## Changing defaults to 25s to fix connection issues with VPC clusters + minInterval: 25s # Client keepalive settings for communicating with other peer nodes client: # Interval is the time between pings to peer nodes. This must # greater than or equal to the minInterval specified by peer # nodes - interval: 60s + ## Changing defaults to 30s to fix connection issues with VPC clusters + interval: 30s # Timeout is the duration the client waits for a response from # peer nodes before closing the connection timeout: 20s @@ -97,7 +99,8 @@ peer: # Interval is the time between pings to ordering nodes. This must # greater than or equal to the minInterval specified by ordering # nodes. - interval: 60s + ## Changing defaults to 30s to fix connection issues with VPC clusters + interval: 30s # Timeout is the duration the client waits for a response from # ordering nodes before closing the connection timeout: 20s diff --git a/defaultconfig/peer/v25/core.yaml b/defaultconfig/peer/v25/core.yaml index a62be343..01ae3649 100644 --- a/defaultconfig/peer/v25/core.yaml +++ b/defaultconfig/peer/v25/core.yaml @@ -84,13 +84,15 @@ peer: # MinInterval is the minimum permitted time between client pings. # If clients send pings more frequently, the peer server will # disconnect them - minInterval: 60s + ## Changing defaults to 25s to fix connection issues with VPC clusters + minInterval: 25s # Client keepalive settings for communicating with other peer nodes client: # Interval is the time between pings to peer nodes. This must # greater than or equal to the minInterval specified by peer # nodes - interval: 60s + ## Changing defaults to 30s to fix connection issues with VPC clusters + interval: 30s # Timeout is the duration the client waits for a response from # peer nodes before closing the connection timeout: 20s @@ -100,7 +102,8 @@ peer: # Interval is the time between pings to ordering nodes. This must # greater than or equal to the minInterval specified by ordering # nodes. - interval: 60s + ## Changing defaults to 30s to fix connection issues with VPC clusters + interval: 30s # Timeout is the duration the client waits for a response from # ordering nodes before closing the connection timeout: 20s diff --git a/pkg/offering/base/orderer/override/deployment.go b/pkg/offering/base/orderer/override/deployment.go index 266d1c57..8220fa5f 100644 --- a/pkg/offering/base/orderer/override/deployment.go +++ b/pkg/offering/base/orderer/override/deployment.go @@ -289,6 +289,9 @@ func (o *Override) CommonDeploymentOverrides(instance *current.IBPOrderer, deplo orderer.SetStartupProbe(nil) } + // Overriding keepalive default serverMinInterval to 25s to make this work on VPC clusters + orderer.AppendEnvIfMissing("ORDERER_GENERAL_KEEPALIVE_SERVERMININTERVAL", "25s") + deployment.UpdateContainer(orderer) deployment.UpdateContainer(grpcProxy) deployment.UpdateInitContainer(initCont) diff --git a/pkg/offering/base/peer/override/deployment.go b/pkg/offering/base/peer/override/deployment.go index be4b83da..d32b3d5d 100644 --- a/pkg/offering/base/peer/override/deployment.go +++ b/pkg/offering/base/peer/override/deployment.go @@ -443,6 +443,11 @@ func (o *Override) V2Deployment(instance *current.IBPPeer, deployment *dep.Deplo peerContainer.AppendEnvIfMissing("IBP_BUILDER_ENDPOINT", "127.0.0.1:11111") peerContainer.AppendEnvIfMissing("PEER_NAME", instance.GetName()) + // Overriding keepalive flags for peers to fix connection issues with VPC clusters + peerContainer.AppendEnvIfMissing("CORE_PEER_KEEPALIVE_MININTERVAL", "25s") + peerContainer.AppendEnvIfMissing("CORE_PEER_KEEPALIVE_CLIENT_INTERVAL", "30s") + peerContainer.AppendEnvIfMissing("CORE_PEER_KEEPALIVE_DELIVERYCLIENT_INTERVAL", "30s") + // Will delete these envs if found, these are not required for v2 peerContainer.DeleteEnv("CORE_VM_ENDPOINT") peerContainer.DeleteEnv("CORE_CHAINCODE_GOLANG_RUNTIME")