-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
beginnerIssues suitable for new developersIssues suitable for new developersenhancementImprovements to existing features / behaviourImprovements to existing features / behaviourfeature requestRequests for new featuresRequests for new featuresgossipp2pCode related to the peer-to-peer behaviourCode related to the peer-to-peer behaviour
Description
LND currently constructs a new batch of gossip messages to broadcast every 90s using a trickleTimer in the gossiper. Every time the timer expires, the messages are deduplicated and immediately broadcast to all peers that are receiving updates.
This approach creates needlessly bursty resource usage on both the sending and receiving side, and profiling confirms that this creates punctuated equilibriums in terms of bandwidth/cpu/memory. We can achieve more stable and consistent resource usage by dispersing each newly created batch over the subsequent 90s instead of delivering them all at once.
Steps to completion:
- Decide how often the sub-batches should be sent, e.g. 5 seconds
- Split an announcement batch into the sub-batches, where the size of each sub-batch should be roughly
len(announcementBatch)/numSubBatchesIn90s, bonus points for using slice tricks - Instead of queueing the entire
announcmentBatchimmediately, spawn a goroutine to perform the remainder of the queueing logic for each sub-batch on the chosen interval. Note that the set of GossipSyncers can change over this period, so the syncers and filtering logic should be evaluated at the time each sub-batch is processed
Additional Considerations:
- Should we enforce a minimum batch size? If we only have 10 updates to send, do we really want to space each message by 5 seconds?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
beginnerIssues suitable for new developersIssues suitable for new developersenhancementImprovements to existing features / behaviourImprovements to existing features / behaviourfeature requestRequests for new featuresRequests for new featuresgossipp2pCode related to the peer-to-peer behaviourCode related to the peer-to-peer behaviour