Skip to content
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

fix(root): spawn state root task only if host has enough parallelism #14555

Merged
merged 2 commits into from
Feb 18, 2025

Conversation

shekhirin
Copy link
Collaborator

/// Determines if the host has enough parallelism to run the state root task.
///
/// It requires at least 5 parallel threads:
/// - Engine in main thread that spawns the state root task.
/// - State Root Task spawned in [`StateRootTask::spawn`]
/// - Sparse Trie spawned in [`run_sparse_trie`]
/// - Multiproof computation spawned in [`MultiproofManager::spawn_multiproof`]
/// - Storage root computation spawned in [`ParallelProof::multiproof`]
pub(crate) fn has_enough_parallelism() -> bool {
std::thread::available_parallelism().map_or(false, |num| num.get() >= 5)
}

@shekhirin shekhirin added C-bug An unexpected or incorrect behavior A-engine Related to the engine implementation labels Feb 18, 2025
@shekhirin shekhirin force-pushed the alexey/state-root-task-has-enough-pararallelism branch from 94083a9 to 1641c5b Compare February 18, 2025 09:23
@shekhirin shekhirin marked this pull request as ready for review February 18, 2025 09:28
@jenpaff jenpaff linked an issue Feb 18, 2025 that may be closed by this pull request
@shekhirin shekhirin added this pull request to the merge queue Feb 18, 2025
Merged via the queue into main with commit 42f8223 Feb 18, 2025
41 checks passed
@shekhirin shekhirin deleted the alexey/state-root-task-has-enough-pararallelism branch February 18, 2025 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-engine Related to the engine implementation C-bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking: Performance
2 participants