Skip to content

Commit

Permalink
Add minimum allocation size
Browse files Browse the repository at this point in the history
  • Loading branch information
rdettai committed Dec 12, 2024
1 parent b587245 commit 2b434cd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions quickwit/quickwit-search/src/search_permit_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ pub fn compute_initial_memory_allocation(
warmup_single_split_initial_allocation: ByteSize,
) -> ByteSize {
let split_size = split.split_footer_start;
// we consider the configured initial allocation to be set for a large split with 10M docs
const LARGE_SPLIT_NUM_DOCS: u64 = 10_000_000;
let proportional_allocation =
warmup_single_split_initial_allocation.as_u64() * split.num_docs / 10_000_000;
warmup_single_split_initial_allocation.as_u64() * split.num_docs / LARGE_SPLIT_NUM_DOCS;
let size_bytes = [
split_size,
proportional_allocation,
Expand All @@ -77,7 +79,8 @@ pub fn compute_initial_memory_allocation(
.into_iter()
.min()
.unwrap();
ByteSize(size_bytes)
const MINIMUM_ALLOCATION_BYTES: u64 = 10_000_000;
ByteSize(size_bytes.max(MINIMUM_ALLOCATION_BYTES))
}

impl SearchPermitProvider {
Expand Down

0 comments on commit 2b434cd

Please sign in to comment.