pageserver: add separate semaphore for L0 compaction #10780
Merged
+111
−68
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
L0 compaction frequently gets starved out by other background tasks and image/GC compaction. L0 compaction must be responsive to keep read amplification under control.
Touches #10694.
Resolves #10689.
Summary of changes
Use a separate semaphore for the L0-only compaction pass.
CONCURRENT_L0_COMPACTION_TASKS
semaphore andBackgroundLoopKind::L0Compaction
.compaction_l0_semaphore
(default off viacompaction_l0_first
).OnlyL0Compaction
pass.CompactFlags::NoYield
to disable L0 yielding, and set it for the HTTP API route.use_compaction_semaphore
setting and compaction-scoped semaphore.