Skip to main content

Disk I/O

The goal of Feuer is to maximize utilization of resources. If you pay for an SSD or network, you want to use it to the maximum. Anything else is wasted resources.

Reads take precedence over writes​

Writing to a disk cache only pays off by increasing future disk hits. When reads are already maxing out the SSD, spending disk capacity on background writes to raise the hit rate further is counterproductive: the drive cannot serve more reads anyway, so extra writes only steal bandwidth and add latency to active reads.

When reads leave headroom on the drive, writes should use that spare capacity to keep the cache warm. Feuer shares IoQueues across caches with separate io_uring rings and worker threads for reads and writes. When reads wait for read-channel capacity, Feuer throttles writes down to 1 active write at 1 GiB/s. See the write-pacing benchmark appendix for the measurements behind those numbers.

Fall through to source when disk reads back up​

Fall-through lets an application max out disk and network together instead of queuing every request behind a saturated SSD.

This way you can also utilize the different performance profiles of disk and network. Local NVMe SSDs are great for small random reads, while some network interfaces are much faster for large reads.

Since Feuer does not know the application's network bandwidth, it lets the application decide when to fall through to the source. Also keep in mind that S3 GETs are not free, so you may want to limit fall-through to avoid unnecessary costs.

When waiting reads reach IoQueuesConfig::fallthrough_waiters, Feuer notifies unchecked waiting callers that used get_or_fetch_with_disk_fallthrough to run their fallthrough predicate.

For a real-world example, see Quickwit's storage cache, which only falls through for large byte ranges (20 MB by default) and caps concurrent fall-through downloads with a semaphore (32 by default).

See the I/O queue explorer for the full read, fallthrough, and write-pacing pipeline.

Write 1-MiB chunks​

Small writes waste NVMe bandwidth. Ideal write sizes for local NVMe SSDs are between 256 KiB and 1 MiB.

Since every write is best-effort, we can take the liberty of packing small objects into a single 1-MiB write. Larger objects reserve consecutive whole 1-MiB chunks so every entry's payload occupies one contiguous disk byte range. Metadata lives in separate 1-MiB metadata chunks organized into 4-KiB pages (see the on-disk format specification).

Small objects share a chunk A large object spans chunks
┌─────────────────────────┐ ┌───────────────────────────────┐
│ object A │ B │ object C │ │ object D │
└─────────────────────────┘ └───────────────────────────────┘
1 MiB consecutive chunks

Splitting 1-MiB writes into 64-KiB requests during mixed reads showed no consistent read-throughput benefit in the tested workloads.

Write-size comparison during reads

In a sequential write-size test at QD1, increasing request size from 4 KiB to 256 KiB raised throughput from 217 MB/s to 1,829 MB/s, where throughput plateaued through 1 MiB.

Transfer-size results

Appendix: Pacing writes under read pressure​

Limiting write concurrency alone does not protect reads. In a saturation test on an EC2 m8gd.8xlarge local NVMe SSD (direct I/O, 32 read callers with a mixed read-size distribution plus continuous 1-MiB writers), even a single unpaced writer still pushed 1,570 MB/s and cut read throughput by 35%.

Instead of relying on concurrency limits or stopping writes completely, Feuer watches read-channel waits as a pressure signal:

  • With no waiting reads, up to 8 writes run unpaced.
  • While reads are waiting, and for a 100 ms hold after the last wait clears, Feuer allows 1 active write throttled to 1 GiB/s.
  • In-flight writes finish normally. Queued writes wait in the write channel as backpressure.

That 100 ms hold matters during bursts. Without it, waits briefly drop to zero between bursts, normal 8-write admission stays active for 91-93% of the run, and read throughput still drops by ~30%.

Here is how those policies compare on the same saturation test (8 write callers):

Write policy under read pressureRead MB/sWrite MB/sRead p95 msRead p99 ms
Read-only3,879026.932.1
Unrestricted (8 active writes)2,6151,61853.474.3
1 GiB/s cap + 100 ms hold3,87992827.137.0
4 GiB/s cap + 100 ms hold2,5691,59850.765.7

At 1 GiB/s, read throughput matches the read-only baseline and p99 stays close (37.0 ms vs. 32.1 ms), while writes still do nearly 1 GB/s. Raising the cap to 4 GiB/s loses that protection.

These numbers are from one NVMe drive class under sustained saturation. Your mileage will vary with request sizes, traffic shape, and SSD model. You can run your own size mix with the read/write storage benchmark.