From 3944c25853b425db8e8b331cc5af92885b3593e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Thu, 20 Nov 2025 10:29:50 +0100 Subject: [PATCH 1/2] Clamp the maximum batch size to maximum 10GiB --- crates/meilisearch/src/lib.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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, From 753ba3919964e0019f7ff0507186a23ed00acf5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Thu, 20 Nov 2025 10:33:02 +0100 Subject: [PATCH 2/2] Update the documentation of the batch size --- crates/meilisearch/src/option.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)]