When a Benchmark Measures Buffering

A function can return before underlying data transfers are complete. Measure the promised completion stage if downstream consumers need the finished result.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace a small write
  2. Choose comparable endpoints
  3. Time how far output actually travels
  4. Verify useful output at the timed boundary

Trace a small write

Enqueuing bytes in a local buffer may be quicker than persisting or delivering them. Buffered writing and flushing describe this distinction.

Choose comparable endpoints

One implementation may wait for completion and another may return a pending handle. Check both outcomes by the same contract. See accepted and completed work.[1]

Time how far output actually travels

Writing one hundred result lines can finish quickly if the library stores them in a user-space buffer. A consumer may only see them after flush or later operations. Decide whether the benchmark measures buffered acceptance, consumer visibility or durability. See buffered and durable writes.

Time A ends after write-call returns
Time B ends after flush and observation by reader
Stronger persistence can require another measured operation

Verify useful output at the timed boundary

A benchmark that discards output may omit real storage cost. Test an actual consumer reading complete bytes and state which work was inside the timing.

References

  1. Google, Site Reliability Engineering ↩