materialize icon indicating copy to clipboard operation
materialize copied to clipboard

persist: spin off separate compaction worker per shard

Open pH14 opened this issue 1 year ago • 0 comments

With bounded memory compaction, we can now be assured that a single compaction operation does not exceed a particular amount of memory. However! It's still possible for compaction operations of a single process to overlap one another, especially when compacting many batches at once, which means that we can't yet guarantee a particular memory usage for a given shard.

Similar to https://github.com/MaterializeInc/materialize/pull/14064, this PR spins out a separate background compaction worker per shard, each ensuring only 1 compaction request is executed at a time. To keep things simple at the start, no effort to merge compaction requests is made. A new metric compaction.requested has been added that will help give visibility into whether we're accumulating a backlog of compaction reqs or not.

Motivation

Tips for reviewer

Checklist

pH14 avatar Sep 16 '22 15:09 pH14