From a59f437ee39432e9c056523e07404efcc961d1fa Mon Sep 17 00:00:00 2001 From: Tamo Date: Mon, 28 Jun 2021 14:35:50 +0200 Subject: [PATCH] use only half of the computer threads for the indexation by default --- Cargo.lock | 1 + meilisearch-http/Cargo.toml | 1 + meilisearch-http/src/index/update_handler.rs | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 1eee0fe65..de2ffc0dc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1631,6 +1631,7 @@ dependencies = [ "milli", "mime", "mockall", + "num_cpus", "obkv", "once_cell", "oxidized-json-checker", diff --git a/meilisearch-http/Cargo.toml b/meilisearch-http/Cargo.toml index 5d2fdbcad..353401382 100644 --- a/meilisearch-http/Cargo.toml +++ b/meilisearch-http/Cargo.toml @@ -53,6 +53,7 @@ meilisearch-tokenizer = { git = "https://github.com/meilisearch/tokenizer.git", memmap = "0.7.0" milli = { git = "https://github.com/meilisearch/milli.git", tag = "v0.6.0" } mime = "0.3.16" +num_cpus = "1.13.0" once_cell = "1.5.2" oxidized-json-checker = "0.3.2" parking_lot = "0.11.1" diff --git a/meilisearch-http/src/index/update_handler.rs b/meilisearch-http/src/index/update_handler.rs index 9896c9391..4d860ed7e 100644 --- a/meilisearch-http/src/index/update_handler.rs +++ b/meilisearch-http/src/index/update_handler.rs @@ -23,7 +23,7 @@ pub struct UpdateHandler { impl UpdateHandler { pub fn new(opt: &IndexerOpts) -> anyhow::Result { let thread_pool = rayon::ThreadPoolBuilder::new() - .num_threads(opt.indexing_jobs.unwrap_or(0)) + .num_threads(opt.indexing_jobs.unwrap_or(num_cpus::get() / 2)) .build()?; Ok(Self { max_nb_chunks: opt.max_nb_chunks,