# Argon: denominators and cache-cost arithmetic

Educational calculation, not measurements or an Argon implementation.
Run `node --test model.test.mjs` beside `model.mjs`. No dependencies or device access.

Throughput efficiency is shared / (allocated time share * standalone).
Alone and shared rates must use matching units and workload definitions.
A zero allocated share has an undefined normalization; values above one are not clipped.

The cache example assumes one outstanding read, constant hit/miss service costs,
no queueing, unchanged disk service cost, and throughput equal to inverse mean service.
Costs are 1 and 100 microseconds, initial hit probability 0.9, target 0.9.
Mean service is c + (1-p)*(d-c).
Solve S(alone)/S(candidate) >= R, giving
p_min = max(0, 1 - (S(alone)/R - c)/(d-c)) for d>c.
Equal costs make cache-hit probability irrelevant in this model.

Multiplying p by R gives 0.81 and retains 1090/1981 of standalone throughput,
about 55.02%, not 90%. The throughput constraint instead requires p >= 791/891,
about 88.78%. This identifies a denominator mistake, not a cache size in bytes.
Mapping a hit probability to memory requires a workload-specific cache profile.
No request-completion distribution or confidence interval follows from these inputs.

Primary source: Wachs, Abd-El-Malek, Thereska and Ganger, Argon: performance
insulation for shared storage servers, FAST 2007, section 3.4.
https://www.pdl.cmu.edu/ftp/Storage/argon-fast07.pdf
The example inputs are selected by Hesela; they are not digitized paper results.

## From probability to listed capacities

The additional table is a synthetic profile, not a measured trace or an Argon
replication. Each workload has a standalone hit probability of 0.90 at 256 MiB.
At capacities 0, 64, 128 and 256 MiB, workload A has probabilities
0, 0.85, 0.90, 0.90; B has 0, 0.50, 0.81, 0.90.
One MiB is 1,048,576 bytes. The same 791/891 threshold selects 128 MiB for A
and 256 MiB for B: 384 MiB total. These listed candidates exceed a 256 MiB
data-cache budget but fit 384 MiB. Metadata and other buffers are excluded.
Equal 128 MiB partitions retain 100% and 55.02% of the respective serial-read
baseline rates under the fixed costs above.

The lookup validates all points, requires strictly increasing integer byte
capacities and accepts nonmonotone hit probabilities. It returns the smallest
qualifying LISTED capacity, not the true minimum over unsampled capacities.
No interpolation, extrapolation, confidence interval or monotonicity repair
is performed. A profile with no qualifying point is unresolved, not proof that
no possible capacity could work. The budget result assumes independent,
exclusive partitions and unchanged per-workload profiles, costs and baseline.
It is not an admission guarantee, a cache allocator or a latency bound.

Additional evidence: Waldspurger et al., Cache Modeling and Optimization using
Miniature Simulations, USENIX ATC 2017, sections 1.1 and 4.1 (nonmonotonic
ARC/LIRS behavior). https://www.usenix.org/system/files/conference/atc17/atc17-waldspurger.pdf
This is distinct from noisy estimates of a stack-policy curve. The tests
include 625 arbitrary four-point profiles, four thresholds each, and explicit
budget, missing-data, invalid-input and nonmonotone controls.

## Numerical boundary

The implementation evaluates the equivalent expression
p_min = max(0, p - ((1-R)/R) * S(p)/(d-c)), with R=1 returning p exactly
when d>c. Subtracting two values near one previously erased tiny positive
thresholds. For p=1e-17 and R=1, the old expression returned zero and could
select a zero-byte profile point. Boundary tests now reject that allocation.
The teaching inputs and physical assumptions are unchanged; this is floating-point
robustness, not additional accuracy in the workload model.
