From 667b2aa2bc9649e3ee6460cda26d285bdf854411 Mon Sep 17 00:00:00 2001 From: petricadaipegsp <155911522+petricadaipegsp@users.noreply.github.com> Date: Tue, 3 Dec 2024 12:00:48 +0100 Subject: [PATCH] Increase gossip history and length (#401) * Increase gossip history and length * Increase peer outbound queue size --- go-libp2p-blossomsub/blossomsub.go | 4 ++-- go-libp2p-blossomsub/pubsub.go | 3 +++ node/config/p2p.go | 1 + node/p2p/blossomsub.go | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/go-libp2p-blossomsub/blossomsub.go b/go-libp2p-blossomsub/blossomsub.go index 5888bfc..748c970 100644 --- a/go-libp2p-blossomsub/blossomsub.go +++ b/go-libp2p-blossomsub/blossomsub.go @@ -37,8 +37,8 @@ var ( BlossomSubDhi = 12 BlossomSubDscore = 4 BlossomSubDout = 2 - BlossomSubHistoryLength = 5 - BlossomSubHistoryGossip = 3 + BlossomSubHistoryLength = 9 + BlossomSubHistoryGossip = 6 BlossomSubDlazy = 6 BlossomSubGossipFactor = 0.25 BlossomSubGossipRetransmission = 3 diff --git a/go-libp2p-blossomsub/pubsub.go b/go-libp2p-blossomsub/pubsub.go index 69518a7..13e323e 100644 --- a/go-libp2p-blossomsub/pubsub.go +++ b/go-libp2p-blossomsub/pubsub.go @@ -32,6 +32,9 @@ const DefaultSoftMaxMessageSize = 1 << 20 // DefaultHardMaxMessageSize is 20 MB. const DefaultHardMaxMessageSize = 10 << 21 +// DefaultPeerOutboundQueueSize is the default size of the outbound message channel that we maintain for each peer. +const DefaultPeerOutboundQueueSize = 128 + var ( // TimeCacheDuration specifies how long a message ID will be remembered as seen. // Use WithSeenMessagesTTL to configure this per pubsub instance, instead of overriding the global default. diff --git a/node/config/p2p.go b/node/config/p2p.go index 49d7306..b6b54e5 100644 --- a/node/config/p2p.go +++ b/node/config/p2p.go @@ -54,4 +54,5 @@ type P2PConfig struct { ValidateQueueSize int `yaml:"validateQueueSize"` ValidateWorkers int `yaml:"validateWorkers"` SubscriptionQueueSize int `yaml:"subscriptionQueueSize"` + PeerOutboundQueueSize int `yaml:"peerOutboundQueueSize"` } diff --git a/node/p2p/blossomsub.go b/node/p2p/blossomsub.go index 00e9056..cfd1ad9 100644 --- a/node/p2p/blossomsub.go +++ b/node/p2p/blossomsub.go @@ -476,6 +476,7 @@ func NewBlossomSub( blossomOpts = append(blossomOpts, blossomsub.WithValidateQueueSize(p2pConfig.ValidateQueueSize), blossomsub.WithValidateWorkers(p2pConfig.ValidateWorkers), + blossomsub.WithPeerOutboundQueueSize(p2pConfig.PeerOutboundQueueSize), ) blossomOpts = append(blossomOpts, observability.WithPrometheusRawTracer()) blossomOpts = append(blossomOpts, blossomsub.WithPeerFilter(internal.NewStaticPeerFilter( @@ -1174,6 +1175,9 @@ func withDefaults(p2pConfig *config.P2PConfig) *config.P2PConfig { if p2pConfig.SubscriptionQueueSize == 0 { p2pConfig.SubscriptionQueueSize = blossomsub.DefaultSubscriptionQueueSize } + if p2pConfig.PeerOutboundQueueSize == 0 { + p2pConfig.PeerOutboundQueueSize = blossomsub.DefaultPeerOutboundQueueSize + } return p2pConfig }