Skip to content

fix: set the default thread-pool size by the available concurrency #1931

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
merged 2 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions fvm/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Changes to the reference FVM implementation.

## [Unreleased]

Default the concurrency of the `ThreadedExecutor` to the available parallelism instead of 8.

## 4.0.0 (2023-10-31)

Final release, no changes.
Expand Down
4 changes: 2 additions & 2 deletions fvm/src/executor/threaded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ use super::{ApplyKind, ApplyRet, Executor};

lazy_static! {
static ref EXEC_POOL: yastl::Pool = yastl::Pool::with_config(
8,
std::thread::available_parallelism().map(|n|n.get()).unwrap_or(8),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably mention this change in fvm/CHANGELOG.md

yastl::ThreadConfig::new()
.prefix("fvm-executor")
// fvm needs more than the deafault available stack (2MiB):
// fvm needs more than the default available stack (2MiB):
// - Max 2048 wasm stack elements, which is 16KiB of 64bit entries
// - Roughly 20KiB overhead per actor call
// - max 1024 nested calls, which means that in the worst case we need ~36MiB of stack
Expand Down