-
Notifications
You must be signed in to change notification settings - Fork 945
Closed
Labels
optimizationSomething to make Lighthouse run more efficiently.Something to make Lighthouse run more efficiently.v5.3.0Q3 2024 release with database changes!Q3 2024 release with database changes!
Description
Description
The BeaconNodeFallback::broadcast function broadcasts in series when I think it would be more effective in parallel.
The issue with a series broadcast is that the last node in the BN list doesn't receive the message until waiting for the full round-trip of all other BNs.
This presents two immediate issues:
- It's likely that time-sensitive messages (like sync committees) will frequently arrive late to the last node in the BN list, creating spammy logs.
- If an BN early in the list times out then we're very likely to be too late for all other BNs. This is the case for blocks.
Steps to resolve
Instead of this sort of pattern:
for node in nodes {
node.publish().await
}We should adopt something like:
use tokio::task::JoinSet;
let mut set = JoinSet::new();
// Start executing the futures in parallel.
for node in nodes {
set.spawn(node.publish())
}
// Process the results as they come in.
while let Some(response) = set.join_next().await {
// handle `response`
}Metadata
Metadata
Assignees
Labels
optimizationSomething to make Lighthouse run more efficiently.Something to make Lighthouse run more efficiently.v5.3.0Q3 2024 release with database changes!Q3 2024 release with database changes!