-
Notifications
You must be signed in to change notification settings - Fork 932
Description
Description
Currently the Validator Client (VC) polls the validator states for all inactive validators from the Beacon Node (for indices retrieval), once every slot (12 seconds on mainnet)
lighthouse/validator_client/src/duties_service.rs
Lines 279 to 292 in f167951
| loop { | |
| // Run this poll before the wait, this should hopefully download all the indices | |
| // before the block/attestation tasks need them. | |
| poll_validator_indices(&duties_service).await; | |
| if let Some(duration) = duties_service.slot_clock.duration_to_next_slot() { | |
| sleep(duration).await; | |
| } else { | |
| // Just sleep for one slot if we are unable to read the system clock, this gives | |
| // us an opportunity for the clock to eventually come good. | |
| sleep(duties_service.slot_clock.slot_duration()).await; | |
| } | |
| } | |
| }, |
This is mostly not an issue until the number of inactive validator validators reaches a large number ~1000, which is probably quite rare. However we've recently seen some performance issues when the endpoint beacon/states/{state_id}/validators/{validator_id} is called repeatedly in a short period of time. Here's a script created by @michaelsproul to spam this endpoint aggressively, and it turns out this could cause an OOM on the beacon node.
There has been some discussions on how to improve this, potentially queuing the requests, however they might take a while to implement. In the mean time, we can probably reduce the frequency of this query to once or twice per epoch to reduce the performance impact on the node, as validator activation only happens once every epoch, and it may not be necessary to query the indices so often.