-
Notifications
You must be signed in to change notification settings - Fork 931
Use scoped rayon pool for backfill chain segment processing #7924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mergify
merged 25 commits into
sigp:unstable
from
jimmygchen:backfill-verify-kzg-use-scoped-rayon
Sep 18, 2025
Merged
Changes from 12 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
47a80e5
Use scoped rayon pool for chain segment backfill.
jimmygchen 5cbfdb5
Merge branch 'unstable' of https://github.com/sigp/lighthouse into ba…
eserilev cc1b870
Merge branch 'unstable' of https://github.com/sigp/lighthouse into ba…
eserilev 28f6ad2
Create RayonManager struct
eserilev 583aaba
Linting
eserilev 16a1b48
Fix comment
eserilev f81f5ea
Introduce a high prio threadpool for use when backfill rate limiting …
eserilev 067b599
Fix test
eserilev 23bd8bf
Merge branch 'unstable' of https://github.com/sigp/lighthouse into ba…
eserilev 4e884bb
Merge branch 'unstable' of https://github.com/sigp/lighthouse into ba…
eserilev f1144e4
fix test
eserilev ba65b98
Merge branch 'unstable' into backfill-verify-kzg-use-scoped-rayon
eserilev 09433eb
Add default impl
eserilev b5ff451
Remove scoped high prio thread pool in favor of the global thread pool
eserilev 0debde9
Merge branch 'backfill-verify-kzg-use-scoped-rayon' of https://github…
eserilev 1694020
USe the global rayon pool
eserilev 456af43
FMT
eserilev b289f49
Merge branch 'unstable' of https://github.com/sigp/lighthouse into ba…
eserilev 9b57acc
fix test
eserilev dabbdc7
Fix
eserilev 3f57327
ugh
eserilev 091aafb
fix
eserilev 6a525cb
low prio
eserilev 2d7e57a
fix comment
eserilev c0467f4
update minimum thread count to 1
eserilev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| use rayon::{ThreadPool, ThreadPoolBuilder}; | ||
| use std::sync::Arc; | ||
|
|
||
| pub const DEFAULT_LOW_PRIORITY_DIVISOR: usize = 4; | ||
| const MINIMUM_LOW_PRIORITY_THREAD_COUNT: usize = 2; | ||
|
|
||
| pub struct RayonManager { | ||
| /// Smaller rayon thread pool for lower-priority, compute-intensive tasks. | ||
| /// By default ~25% of CPUs or a minimum of 2 threads. | ||
| pub low_priority_threadpool: Arc<ThreadPool>, | ||
| /// Larger rayon thread pool for high-priority, compute-intensive tasks. | ||
| /// By default 100% of CPUs. | ||
| pub high_priority_threadpool: Arc<ThreadPool>, | ||
jimmygchen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
eserilev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| impl RayonManager { | ||
| pub fn new(low_prio_cpu_divisor: usize) -> Self { | ||
eserilev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| let low_prio_threads = | ||
| (num_cpus::get() / low_prio_cpu_divisor).max(MINIMUM_LOW_PRIORITY_THREAD_COUNT); | ||
| let low_priority_threadpool = Arc::new( | ||
| ThreadPoolBuilder::new() | ||
| .num_threads(low_prio_threads) | ||
| .build() | ||
| .expect("failed to build low-priority rayon pool"), | ||
| ); | ||
| let high_priority_threadpool = Arc::new( | ||
| ThreadPoolBuilder::new() | ||
| .num_threads(num_cpus::get()) | ||
| .build() | ||
| .expect("failed to build high-priority rayon pool"), | ||
| ); | ||
| Self { | ||
| low_priority_threadpool, | ||
| high_priority_threadpool, | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.