# Cache hits and request completion can prefer different placements

This is a constructed, deterministic example, not a service benchmark or a reproduction of RobinHood.

## Result

A single resident slot can hold either of two equal-size keys. All 100 application requests query A; the last two also query B simultaneously. A miss takes 10 ms, B takes 100 ms and any hit takes 1 ms. Each request waits for all its queries.

| Fixed resident | Query hits / queries | Request p99 (ms) | Mean request time (ms) |
| --- | --- | --- | --- |
| A | 100 / 102 | 100 | 2.98 |
| B | 2 / 102 | 10 | 10 |
| None (zero-slot control) | 0 / 102 | 100 | 11.8 |
| Both (two-slot control) | 102 / 102 | 1 | 1 |

A wins on query hit ratio and mean request time. B wins on request p99. The two controls use different capacities and are not equal-budget alternatives.

## Method

Each request's time is the maximum of its query times. Nearest-rank p99 is the 99th value after sorting 100 request times. The A placement produces 98 times of 1 ms and two of 100 ms. The B placement produces 100 times of 10 ms. Initial residents are preloaded and fixed; no replacement, queueing, cache fill, writes, key-size variation or concurrency cost is modeled. There are no random samples or statistical confidence intervals.

This is a counterexample to equating cache hit count with end-to-end tail improvement, not proof that choosing B would be optimal under a real changing workload.

## Reproduce

Use Node.js 22 or later, with no external packages:

```sh
node model.mjs --check
node --test model.test.mjs
```

[Generated values](evidence.json), [model](model.mjs), [tests](model.test.mjs).

## Research context

[RobinHood glossary entry](https://hesela.dev/terms/robinhood-caching/) links the original OSDI 2018 paper and version-pinned author code. Its allocation feedback, resize granularity and percentile-window calculation are not implemented by this fixed-placement example.

The pinned source's selector called `robinhood` ranks backend query p99; `crit_path_window` uses the request-blocking window statistic. This distinction is visible in code and does not establish which configuration generated any published figure. Check the configuration and selected function before attempting a reproduction.
