diff --git a/crates/meilisearch/src/lib.rs b/crates/meilisearch/src/lib.rs index cc9189e08..08459dc19 100644 --- a/crates/meilisearch/src/lib.rs +++ b/crates/meilisearch/src/lib.rs @@ -231,8 +231,14 @@ pub fn setup_meilisearch( max_number_of_tasks: 1_000_000, max_number_of_batched_tasks: opt.experimental_max_number_of_batched_tasks, batched_tasks_size_limit: opt.experimental_limit_batched_tasks_total_size.map_or_else( - // By default, we use half of the available memory to determine the size of batched tasks - || opt.indexer_options.max_indexing_memory.map_or(u64::MAX, |mem| mem.as_u64() / 2), + || { + opt.indexer_options + .max_indexing_memory + // By default, we use half of the available memory to determine the size of batched tasks + .map_or(u64::MAX, |mem| mem.as_u64() / 2) + // And never exceed 10 GiB when we infer the limit + .min(10 * 1024 * 1024 * 1024) + }, |size| size.as_u64(), ), index_growth_amount: byte_unit::Byte::from_str("10GiB").unwrap().as_u64() as usize, diff --git a/crates/meilisearch/src/option.rs b/crates/meilisearch/src/option.rs index e03f975af..98191258a 100644 --- a/crates/meilisearch/src/option.rs +++ b/crates/meilisearch/src/option.rs @@ -474,7 +474,8 @@ pub struct Opt { pub experimental_max_number_of_batched_tasks: usize, /// Experimentally controls the maximum total size, in bytes, of tasks that will be processed - /// simultaneously. When unspecified, defaults to half of the maximum indexing memory. + /// simultaneously. When unspecified, defaults to half of the maximum indexing memory and + /// clamped to 10 GiB. /// /// See: #[clap(long, env = MEILI_EXPERIMENTAL_LIMIT_BATCHED_TASKS_TOTAL_SIZE)]