Skip to content

Commit b5f1e53

Browse files
mononoke: use logical number of cpus in our runtime
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
1 parent f87db3e commit b5f1e53

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

eden/mononoke/cmdlib/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ lazy_static = "1.0"
4242
libc = "0.2"
4343
log = { version = "0.4.8", features = ["kv_unstable"] }
4444
maplit = "1.0"
45+
num_cpus = "1.11"
4546
serde = { version = "1.0", features = ["derive", "rc"] }
4647
slog = { version = "2.5", features = ["max_level_debug"] }
4748
slog-term = "2.4.2"

eden/mononoke/cmdlib/src/helpers.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ pub fn create_runtime(
162162
builder.name_prefix(log_thread_name_prefix.unwrap_or("tk"));
163163
if let Some(core_threads) = core_threads {
164164
builder.core_threads(core_threads);
165+
} else {
166+
// TODO(stash) T75113443 remove when
167+
// https://github.com/tokio-rs/tokio/issues/2269 is landed
168+
builder.core_threads(num_cpus::get());
165169
}
166170
builder.build()
167171
}

0 commit comments

Comments
 (0)