Skip to content

Commit

Permalink
mononoke: use logical number of cpus in our runtime
Browse files Browse the repository at this point in the history
Summary:
We are using older version of tokio which spawns as many threads as we have
physical cores instead of the number of logical cores. It was fixed in
tokio-rs/tokio#2269 but we can't use it yet because
we are waiting for another fix to be released -
rust-lang/futures-rs#2154.

For now let's hardcode it in mononoke

Reviewed By: krallin

Differential Revision: D23599140

fbshipit-source-id: 80685651a7a29ba8938d9aa59770f191f7c42b8b
  • Loading branch information
StanislavGlebik authored and facebook-github-bot committed Sep 9, 2020
1 parent f87db3e commit b5f1e53
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions eden/mononoke/cmdlib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ lazy_static = "1.0"
libc = "0.2"
log = { version = "0.4.8", features = ["kv_unstable"] }
maplit = "1.0"
num_cpus = "1.11"
serde = { version = "1.0", features = ["derive", "rc"] }
slog = { version = "2.5", features = ["max_level_debug"] }
slog-term = "2.4.2"
Expand Down
4 changes: 4 additions & 0 deletions eden/mononoke/cmdlib/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ pub fn create_runtime(
builder.name_prefix(log_thread_name_prefix.unwrap_or("tk"));
if let Some(core_threads) = core_threads {
builder.core_threads(core_threads);
} else {
// TODO(stash) T75113443 remove when
// https://github.com/tokio-rs/tokio/issues/2269 is landed
builder.core_threads(num_cpus::get());
}
builder.build()
}
Expand Down

0 comments on commit b5f1e53

Please sign in to comment.