cockroach icon indicating copy to clipboard operation
cockroach copied to clipboard

admission: account for write-amp in disk bandwidth limiter

Open aadityasondhi opened this issue 6 months ago • 3 comments

Previously, we would calculate elastic disk bandwidth tokens using arbitrary load thresholds and an estimate on incoming bytes into the LSM through flushes and ingestions. This calculation lacked accounting for write amplification in the LSM.

This patch simplifies the disk bandwidth limiter to remove the disk load watcher and simply adjust tokens using the known provisioned disk bandwidth. For token deducation, we create a write-amp model that is a relationship between incoming LSM bytes to actual disk writes.

The token granting semantics are as follows:

  • elastic writes: deduct tokens, and wait for positive count in bucket.
  • regular writes: deduct tokens, but proceed even with no tokens available.

The requested write bytes are "inflated" using the estimated write amplification to account for async compactions in the LSM.

This patch also lays the framework for future integrations where we can account for range snapshot ingestions separately as those don't incur the same write amplification as flushed LSM bytes do.

Informs: https://github.com/cockroachdb/cockroach/issues/86857

Release note: None

aadityasondhi avatar Aug 14 '24 20:08 aadityasondhi