# Rotational replication: geometry before copy count

This is an original, deterministic teaching calculation, not measured drive
performance or a reproduction of an SR-Array experiment. Generated 2026-11-10.
Code/data may be reused under CC0-1.0. The cited paper retains its own copyright;
its PDF is not redistributed in this package.

## Reproduce
Run `python3 model.py`, then `python3 -B test_model.py` and
`python3 -B -O test_model.py`. Python standard library only; no random seed.
The JSON contains exact turn fractions and rounded millisecond displays.

## Question and derivation
Hold the spindle period R fixed. Place D point-sized copies at distinct integer
coordinates around a 12-unit circle. Let successive positive gaps be g_i, summing
to 12. Arrival phase is continuous uniform after positioning.

An arrival falls in a gap with probability g_i/12. Within that gap its mean
remaining distance to the next copy is g_i/2. Thus mean first-copy wait is
sum(g_i^2)/24 sector-time units, or R * sum((g_i/12)^2)/2.
The last-copy encounter has mean R minus this value: within a gap the elapsed
distance back to the previous copy is uniform, and a forward sweep reaches that
copy last. These are encounter times; they exclude writing any payload bytes.

Equal gaps minimize the sum of squares at fixed D, giving read mean R/(2D)
and last-copy mean R - R/(2D). Unequal spacing must not use that shortcut.
The maximum first-copy wait approaches the largest gap times R/12; it is not
the mean. Copy count is insufficient without placement geometry.

For read share f, the isolated mixed mean is f*read + (1-f)*write_all.
At f=1/2 it stays R/2. For this foreground-only model, evenly spaced replication
helps the mean when f>1/2 and hurts it when f<1/2. This is not a general workload
recommendation: real seeks, transfer costs and background propagation change it.

## Verification and limitations
The independent test enumerates all 4095 nonempty subsets of a 12-position circle.
For each layout it directly evaluates min/max encounter distances at the midpoint
of every unit interval. Distance is affine inside those intervals, so their
average integrates continuous phase exactly, rather than approximating it with
a random sample. Additional tests cover equal spacing, clustering, invariance,
read/write mix, invalid inputs and exact committed JSON.

At 7200 RPM R=25/3 ms. Two equally spaced copies give 25/12 ms (2.0833) read wait.
Two adjacent coordinates instead give 1525/432 ms (3.5301), with identical copy
count and payload-copy overhead. Single-copy mean is 25/6 ms (4.1667).
Four copies give 25/24 ms (1.0417) read wait but 175/24 ms (7.2917) to encounter
the last copy. These are chosen geometries, not measured sectors or milliseconds.

1/D describes payload-copy space efficiency only. It excludes formatting,
spares, metadata and a separate fault-tolerant mirror. Copies on one device do
not survive that device's loss. No crash consistency, stale-copy selection,
transfer duration, seeking, track switches, concurrency or queueing is modeled.
No confidence interval is warranted for exact constructed arithmetic.

## Evidence
Yu et al., *Trading Capacity for Performance in a Disk Array*, OSDI 2000,
pp. 243-258, sections 2.2 and 3.2-3.4:
https://www.usenix.org/conference/osdi-2000/trading-capacity-performance-disk-array
https://www.usenix.org/legacy/events/osdi2000/full_papers/yugum/yugum.pdf

The equal-spacing read/write formulas provide historical context. The unequal-gap
derivation and exhaustive oracle above are Hesela's explanation, not a claim
of a new theorem. This package does not reproduce the paper's trace replay.

Public explanation: https://hesela.com/tech/hdd/
Definition: https://hesela.dev/terms/rotational-replication/
