p2p: reduce buffering on channels (#6609)

Having smaller buffers in each reactor/channel will mean that there will be fewer stale messages.
This commit is contained in:
Sam Kleinman
2021-06-24 20:38:35 +00:00
committed by GitHub
parent 10d174adcc
commit 917180dfd2
10 changed files with 36 additions and 43 deletions
+3 -2
View File
@@ -51,8 +51,8 @@ func ChannelDescriptor() conn.ChannelDescriptor {
Priority: 1,
SendQueueCapacity: 10,
RecvMessageCapacity: maxMsgSize,
MaxSendBytes: 200,
RecvBufferCapacity: 32,
MaxSendBytes: 200,
}
}
@@ -417,6 +417,7 @@ func (r *ReactorV2) sendRequestForPeers() {
// no peers are available
r.Logger.Debug("no available peers to send request to, waiting...")
r.nextRequestTime = time.Now().Add(noAvailablePeersWaitPeriod)
return
}
var peerID types.NodeID
+1 -5
View File
@@ -19,7 +19,7 @@ import (
"github.com/tendermint/tendermint/types"
)
const queueBufferDefault = 4096
const queueBufferDefault = 32
// ChannelID is an arbitrary channel ID.
type ChannelID uint16
@@ -365,10 +365,6 @@ func (r *Router) createQueueFactory() (func(int) queue, error) {
// wrapper message. The caller may provide a size to make the channel buffered,
// which internally makes the inbound, outbound, and error channel buffered.
func (r *Router) OpenChannel(chDesc ChannelDescriptor, messageType proto.Message, size int) (*Channel, error) {
if size == 0 {
size = queueBufferDefault
}
r.channelMtx.Lock()
defer r.channelMtx.Unlock()