# Reading a disk-array latency target

A mean-latency target needs a population and a denominator. It does not specify
a percentile or a deadline for every request.

This is Hesela's constructed arithmetic example, not a replay of Hibernator,
a queueing simulation, a performance measurement or a comparison of products.
It accompanies the [Hibernator definition](https://hesela.dev/terms/hibernator/).

## Count requests, not groups

Imagine that two disks complete disjoint portions of the same request population:
90 requests take 4 ms each, and 10 take 30 ms each. The request-weighted mean is

    (90 * 4 + 10 * 30) / 100 = 6.6 ms

Averaging the two disk means instead gives 17 ms. Against a 10 ms target, that
mistake changes an aggregate pass into a failure. The slower group still has
30 ms latency: passing the aggregate target does not protect that group.

The denominator here counts each completed request once. It does not include
unfinished requests. Applying this calculation to a fixed-duration sample that
omits slow outstanding work would require a separate account of that omission.

## Equal means, different p99

All values below are deliberately chosen, not collected from a storage device.

| Population | Fast requests | Slow requests | Mean | Nearest-rank p99 | Maximum | Requests over 10 ms |
| --- | --- | --- | --- | --- | --- | --- |
| A | 990 at 4 ms | 10 at 604 ms | 10 ms | 4 ms | 604 ms | 10/1000 |
| B | 980 at 4 ms | 20 at 304 ms | 10 ms | 304 ms | 304 ms | 20/1000 |

Both populations total 10,000 request-milliseconds over 1,000 requests.
The nearest-rank p99 is the sorted observation at position ceil(0.99*N), with
positions starting at one. For A that is the 990th observation, still 4 ms.
For B the same position lies among the slow requests.

Thus a passing mean cannot determine a p99, and a low p99 can coexist with a
much larger maximum. A and B also reverse their ranking under maximum latency
and p99. Choose the metric that matches the service objective; do not infer an
unreported tail from a mean. Other percentile estimators may interpolate at the
boundary, so preserve the estimator as well as the sample count.

## Reproduce and check

Run with Python 3 and its standard library:

    python3 model.py --check
    python3 -B -m unittest discover -s . -p test_model.py

[model.py](model.py) calculates exact rational means from integer-millisecond
bins, without expanding large counts into arrays. [results.json](results.json)
contains the generated values. [test_model.py](test_model.py) checks an independent
expanded-population oracle over 1,600 finite two-bin cases, the p99 boundary,
input rejection and invariance under splitting or reordering bins.

No statistical uncertainty interval is attached: these finite populations are
fully specified, rather than samples used to estimate a physical population.
They demonstrate non-identifiability of a tail from a mean, not a failure rate.

## Source context

Zhu et al., [Hibernator: Helping Disk Arrays Sleep through the Winter](https://john.e-wilkes.com/papers/sosp2005-hibernator.pdf),
SOSP 2005, DOI [10.1145/1095810.1095828](https://doi.org/10.1145/1095810.1095828).
Sections 3.1.1 and 3.3 motivate request weighting and average-target scope.
The calculations above are independently constructed; they do not reproduce
the paper's speed-selection optimizer or energy results.

Accessed 2026-11-29. Paper copyright remains with its rights holders; no paper
figures, traces or full text are redistributed here.
