Skip to content

Commit 438fb65

Browse files
authored
Avoid serving validator endpoints while the node is far behind syncing head (sigp#7962)
A performance issue was discovered when devnet-3 was under non-finality - some of the lighthouse nodes are "stuck" with syncing because of handling proposer duties HTTP requests. These validator requests are higher priority than Status processing, and if they are taking a long time to process, the node won't be able to progress. What's worse is - under long period of non finality, the proposer duties calculation function tries to do state advance for a large number of [slots](https://github.com/sigp/lighthouse/blob/d545ddcbc7d97b24b5c15012d1a5f9a1dae90b2a/beacon_node/beacon_chain/src/beacon_proposer_cache.rs#L183) here, causing the node to spend all its CPU time on a task that doesn't really help, e.g. the computed duties aren't useful if the node is 20000 slots behind. To solve this issue, we use the `not_while_syncing` filter to prevent serving these requests, until the node is synced. This should allow the node to focus on sync under non-finality situations.
1 parent a134d43 commit 438fb65

File tree

1 file changed

+2
-4
lines changed
  • beacon_node/http_api/src

1 file changed

+2
-4
lines changed

beacon_node/http_api/src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ pub fn serve<T: BeaconChainTypes>(
457457
move |network_globals: Arc<NetworkGlobals<T::EthSpec>>,
458458
chain: Arc<BeaconChain<T>>| async move {
459459
match *network_globals.sync_state.read() {
460-
SyncState::SyncingFinalized { .. } => {
460+
SyncState::SyncingFinalized { .. } | SyncState::SyncingHead { .. } => {
461461
let head_slot = chain.canonical_head.cached_head().head_slot();
462462

463463
let current_slot =
@@ -479,9 +479,7 @@ pub fn serve<T: BeaconChainTypes>(
479479
)))
480480
}
481481
}
482-
SyncState::SyncingHead { .. }
483-
| SyncState::SyncTransition
484-
| SyncState::BackFillSyncing { .. } => Ok(()),
482+
SyncState::SyncTransition | SyncState::BackFillSyncing { .. } => Ok(()),
485483
SyncState::Synced => Ok(()),
486484
SyncState::Stalled => Ok(()),
487485
}

0 commit comments

Comments
 (0)