Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

BEEFY: optimize voter event loop for fewer 'active' wakeups #12759

Closed
@acatangiu

Description

Issue

Doing a bit of profiling showed BeefyWorker::run() async task being "active" more than it should, waking up many times even when there haven't been any external events relevant to the voter logic.

Investigating this showed the "culprit" to be listening for network-gossip events in the main async loop. Even if the "interesting" events are only NetEvent::SyncConnected and NetEvent::SyncDisconnected, the BEEFY voter actually wakes up and (uselessly) tries to vote for all network events (which are many!)

Proposed fix

Move network peers tracking to the much lighter BeefyJustifsRequestHandler::run() task (which is also the user of the connected peer set); thus massively decreasing wake-up rate of the heavier BEEFY voter task.

Metadata

Assignees

Labels

I9-optimisationAn enhancement to provide better overall performance in terms of time-to-completion for a task.U2-some_time_soonIssue is worth doing soon.

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions