Skip to content

Commit

Permalink
reduce keepalive interval to avoid connection issues on VPC (hyperled…
Browse files Browse the repository at this point in the history
  • Loading branch information
asararatnakar committed Oct 25, 2023
1 parent b461dcc commit cedae40
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 13 deletions.
3 changes: 2 additions & 1 deletion defaultconfig/orderer/orderer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion defaultconfig/orderer/v2/orderer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion defaultconfig/orderer/v24/orderer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion defaultconfig/orderer/v25/orderer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions defaultconfig/peer/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
9 changes: 6 additions & 3 deletions defaultconfig/peer/v2/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
9 changes: 6 additions & 3 deletions defaultconfig/peer/v25/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions pkg/offering/base/orderer/override/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions pkg/offering/base/peer/override/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit cedae40

Please sign in to comment.