Skip to content

Commit ed0759d

Browse files
Jose García Gimenometa-codesync[bot]
authored andcommitted
Add JK to update concurrency levels
Summary: We've been experiencing CPU spikes during start up of the bookmark service, and tried to fix it by adjusting the concurrency level during repo construction. Since there is a tradeoff between time to start and CPU level, having this value in an JK will make it easier to modify in the future. Reviewed By: mzr Differential Revision: D90111305 fbshipit-source-id: a5ce591a0e034dd8ab8fc91fd12fd86d808544cd
1 parent c52c410 commit ed0759d

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

eden/mononoke/cmdlib/mononoke_app/src/repos_manager.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ use repo_factory::RepoFactoryBuilder;
4343
use stats::prelude::*;
4444
use tracing::info;
4545

46+
fn repos_manager_concurrency() -> Result<usize> {
47+
justknobs::get_as::<usize>("scm/mononoke:repos_manager_concurrency", None)
48+
.context("Failed to read scm/mononoke:repos_manager_concurrency JustKnob")
49+
}
50+
4651
define_stats! {
4752
prefix = "mononoke.app";
4853
initialization_time_millisecs: dynamic_timeseries(
@@ -219,8 +224,8 @@ impl<Repo> MononokeReposManager<Repo> {
219224
anyhow::Ok((repo_id, repo_name, repo))
220225
})
221226
})
222-
// Repo construction can be heavy, 10 at a time is sufficient.
223-
.buffer_unordered(10)
227+
// Repo construction can be heavy, limit concurrency via JK.
228+
.buffer_unordered(repos_manager_concurrency()?)
224229
.map(|r| anyhow::Ok(r??))
225230
.try_collect::<Vec<_>>()
226231
.await?;
@@ -358,8 +363,8 @@ where
358363
anyhow::Ok((repo_id, repo_name, repo))
359364
})
360365
})
361-
// Repo construction can be heavy, 10 at a time is sufficient.
362-
.buffer_unordered(10)
366+
// Repo construction can be heavy, limit concurrency via JK.
367+
.buffer_unordered(repos_manager_concurrency()?)
363368
.map(|r| anyhow::Ok(r??))
364369
.try_collect::<Vec<_>>()
365370
.await?;

eden/mononoke/common/mononoke_macros/just_knobs_defaults/just_knobs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
"scm/mononoke:retry_query_from_replica_with_consistency_check_interval_ms": 200,
109109
"scm/mononoke:retry_query_from_replica_with_consistency_check_hlc_drift_tolerance_ns": 0,
110110
"scm/mononoke:cgdm_reloading_interval_secs": 5,
111-
"scm/mononoke:shardmanager_shutdown_timeout_secs": 10
111+
"scm/mononoke:shardmanager_shutdown_timeout_secs": 10,
112+
"scm/mononoke:repos_manager_concurrency": 30
112113
}
113114
}

0 commit comments

Comments
 (0)