Skip to content

Commit

Permalink
Increase the Max Blocking Threads (#510)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusSorealheis committed Dec 19, 2023
1 parent 245d9bb commit 6d07a86
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/bin/cas.rs
Expand Up @@ -665,7 +665,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {

let mut cfg = futures::executor::block_on(get_config())?;

let mut metrics_enabled = {
let ( mut metrics_enabled, max_blocking_threads) = {
// Note: If the default changes make sure you update the documentation in
// `config/cas_server.rs`.
const DEFAULT_MAX_OPEN_FILES: usize = 512;
Expand Down Expand Up @@ -700,14 +700,16 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.default_digest_hash_function
.unwrap_or(ConfigDigestHashFunction::sha256),
))?;
!global_cfg.disable_metrics
// TODO (#513): prevent deadlocks by assigning max blocking threads number of open files * ten
(!global_cfg.disable_metrics, global_cfg.max_open_files * 10)
};
// Override metrics enabled if the environment variable is set.
if std::env::var(METRICS_DISABLE_ENV).is_ok() {
metrics_enabled = false;
}
let server_start_time = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs();
let runtime = tokio::runtime::Builder::new_multi_thread()
.max_blocking_threads(max_blocking_threads)
.enable_all()
.on_thread_start(move || set_metrics_enabled_for_this_thread(metrics_enabled))
.build()?;
Expand Down

0 comments on commit 6d07a86

Please sign in to comment.