Skip to content

Commit

Permalink
optimize for large task
Browse files Browse the repository at this point in the history
Signed-off-by: Little-Wallace <[email protected]>
  • Loading branch information
Little-Wallace committed May 6, 2024
1 parent 222b291 commit 136929b
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/meta/src/hummock/compaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,19 @@ pub fn create_compaction_task(
let target_file_size = if input.target_level == 0 {
compaction_config.target_file_size_base
} else if input.target_level == base_level {
// This is just a temporary optimization measure. We hope to reduce the size of SST as much
// as possible to reduce the amount of data blocked by a single task during compaction,
// but too many files will increase computing overhead.
// TODO: remove it after can reduce configuration `target_file_size_base`.
compaction_config.target_file_size_base / 4
let task_size = input.target_input_size + input.select_input_size'
if task_size < compaction_config.max_bytes_for_level_base {
// This is just a temporary optimization measure. We hope to reduce the size of SST as much
// as possible to reduce the amount of data blocked by a single task during compaction,
// but too many files will increase computing overhead.
// TODO: remove it after can reduce configuration `target_file_size_base`.
compaction_config.target_file_size_base / 4
} else if task_size < compaction_config.max_compaction_bytes {
compaction_config.target_file_size_base
} else {
const MAX_FILE_COUNT: u64 = 256;
std::cmp::max(compaction_config.target_file_size_base, task_size / MAX_FILE_COUNT)
}
} else {
assert!(input.target_level >= base_level);
let step = (input.target_level - base_level) / 2;
Expand Down

0 comments on commit 136929b

Please sign in to comment.