-
Notifications
You must be signed in to change notification settings - Fork 943
Open
Labels
beacon-processorGlorious beacon processor, guardian against chaos yet chaotic itselfGlorious beacon processor, guardian against chaos yet chaotic itselfoptimizationSomething to make Lighthouse run more efficiently.Something to make Lighthouse run more efficiently.
Description
The beacon processor counts async and blocking tasks in the same bucket, which can cause the node to struggle when there are long-running async tasks. This prevents the processor from scheduling more work even when CPU capacity is available.
Problem
- The beacon processor uses a single
current_workerscounter for both async and blocking tasks - Worker capacity checks compare
current_workersagainstmax_workers(set to CPU count) - Async tasks like
BlocksByRangeRequestdon't block threads but still consume a worker slot - Long-running async tasks can take seconds while holding a slot
- This prevents CPU-intensive blocking tasks from being scheduled, even when the CPU is idle
Proposed Changes
The current approach treats all work the same, but async and blocking tasks have different resource usage patterns. Possible solutions:
- Manage async and blocking tasks with separate counters and capacity limits within the beacon processor
- Alternatively, let the tokio runtime manage async tasks directly while the beacon processor only manages blocking work
- Consider that blocking tasks may use rayon thread pools, so capacity planning should avoid over-scheduling
The safest approach is likely to start with separate management within the beacon processor before considering delegation to tokio.
Testing
- Monitor beacon processor metrics during various load scenarios (sync, high RPC load, attestation bursts, sync committee messages)
- Verify that CPU utilization stays high without over-subscription
- Test that blocking tasks get scheduled promptly during heavy async activity
Metadata
Metadata
Assignees
Labels
beacon-processorGlorious beacon processor, guardian against chaos yet chaotic itselfGlorious beacon processor, guardian against chaos yet chaotic itselfoptimizationSomething to make Lighthouse run more efficiently.Something to make Lighthouse run more efficiently.