10000 Change broadcastHasVote and broadcastHasBlockpart to use TrySend not Send · Issue #3151 · cometbft/cometbft · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Change broadcastHasVote and broadcastHasBlockpart to use TrySend not Send #3151
Closed
@ValarDragon

Description

@ValarDragon

Feature Request

Summary

Currently both BroadcastHasVote and BroadcastHasBlockpart use Broadcast, which does a Send message to every peer.

While its not clear that BroadcastHasVote is needed, it definitely should be using TrySend not Send! TrySend makes it ignore the channel buffering capacity, and depend on time.Sleep's for cancelling. This increases the overhead for the go scheduler, which does actually take a lot of the time for the system. (Just creating the timers takes 30s of CPU time across a 1hour cpu profile, independent of the scheduler overhead)

Theres a number of things worth revisting about this BroadcastHas*, but it seems like we should be using TrySend everytime not Send. The channel capacity for hasVote is sent to 1, so were not really respecting that right now with the correct behavior. Its likely to me this is an accident in implementation, since the Broadcast method already existed, and used Send, with no corresponding trySend method.

Problem Definition

Reduce our CPU and scheduling overheads, and respect the channel capacities, so we don't "overgossip" from Has* channels.

Proposal

For now, just make a BroadcastTrySend method, and switch the consensus gossip routines to using that!

If for some reason we really wanted Send (which doesn't make sense to me) then we should raise the channel capacities.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0