-
Notifications
You must be signed in to change notification settings - Fork 925
Open
Labels
fork_choiceoptimizationSomething to make Lighthouse run more efficiently.Something to make Lighthouse run more efficiently.
Description
Description
Currently we hold the fork choice write lock while writing to disk:
lighthouse/beacon_node/beacon_chain/src/beacon_chain.rs
Lines 4000 to 4002 in e5b4983
// The fork choice write-lock is dropped *after* the on-disk database has been updated. | |
// This prevents inconsistency between the two at the expense of concurrency. | |
drop(fork_choice); |
This poses a potential problem for fork choice lock readers, which will be blocked while waiting for this write to complete. We expect that writing to disk takes hundreds of milliseconds several seconds due to diff computation and overhead due to database I/O.
Metrics
Metrics seem to indicate that this is not a significant performance issue:
# HELP beacon_fork_choice_read_lock_aquire_seconds Time taken to aquire the fork-choice read lock
# TYPE beacon_fork_choice_read_lock_aquire_seconds histogram
beacon_fork_choice_read_lock_aquire_seconds_bucket{le="0.0001"} 1025501427
beacon_fork_choice_read_lock_aquire_seconds_bucket{le="0.0004"} 1086019739
beacon_fork_choice_read_lock_aquire_seconds_bucket{le="0.0016"} 1254510271
beacon_fork_choice_read_lock_aquire_seconds_bucket{le="0.0064"} 1313781698
beacon_fork_choice_read_lock_aquire_seconds_bucket{le="0.0256"} 1316301315
beacon_fork_choice_read_lock_aquire_seconds_bucket{le="0.1024"} 1316615602
beacon_fork_choice_read_lock_aquire_seconds_bucket{le="0.4096"} 1316673956
beacon_fork_choice_read_lock_aquire_seconds_bucket{le="+Inf"} 1316682131
beacon_fork_choice_read_lock_aquire_seconds_sum 378137.6061273879
beacon_fork_choice_read_lock_aquire_seconds_count 1316682131
TODO: more analysis here
Steps to resolve
Please describe the steps required to resolve this issue, if known.
Metadata
Metadata
Assignees
Labels
fork_choiceoptimizationSomething to make Lighthouse run more efficiently.Something to make Lighthouse run more efficiently.