cockroachdb / pebble

RocksDB/LevelDB inspired key-value database in Go
BSD 3-Clause "New" or "Revised" License
4.77k stars 442 forks source link

db: shared compaction concurrency limit across multiple Pebble instances #3813

Open sumeerbhola opened 1 month ago

sumeerbhola commented 1 month ago

In CockroachDB multi-store deployments, especially with large numbers of stores (8 or more), the CPU consumed by compactions can be significant. We do need a per store compaction concurrency limit, since disk bandwidth is a per-store resource, but we should additionally have a shared compaction concurrency limiter.

This shared limiter should fairly adjudicate on which compaction gets to run next based on a score of how important it is. For example,

Jira issue: PEBBLE-230

sumeerbhola commented 1 month ago

NB: this is orthogonal to https://github.com/cockroachdb/pebble/issues/1329 which would adjust the node-level concurrency limit based on the available CPU. We would still need a limiter component that would decide which among the queue of potential compactions gets to run next.

itsbilal commented 1 month ago

Cockroach side issue, if we explore a solution higher up: https://github.com/cockroachdb/cockroach/issues/74697