Experiment note · exp006 · prompt_cache_key bucket-splitting measurement · how hard is the docs-stated ‘per-bucket limit’ in practice
exp006 — Splitting the cache key into many buckets barely moved the cache
By Hyeonsang Jeon · Global Black Belt, Cloud & AI Apps
Azure prompt caching reuses the shared front part (the prefix) of your requests cheaply. But the docs attach a warning: pile too many requests onto one cache key and it overflows past roughly 15 requests per minute per (prefix hash, cache key), and the cache goes cold. The common remedy is to split the cache key into several buckets (raising prompt_cache_key cardinality). This note measures whether that remedy actually protects the cache, on one live gpt-5.2 pay-as-you-go (PAYG) deployment.
We predicted it would. Send everything to one key (cardinality 1) and you cross the docs limit and the cache cools; split into 8 (cardinality 8) and each bucket drops below the limit, so cache hit should recover visibly. Our pre-registered reading had two branches: if the hit ratio climbs a lot from 1 to 8, bucket-splitting is a real lever; if it barely moves, the limit is soft on this deployment.
The measurement chose the second branch. Piling 30 requests per minute onto a single key — twice the docs limit — still held steady-state cache hit at 93.34% (in_memory) and 96.12% (24h), and splitting into 8 moved it only +2.52 pp (in_memory) and −0.00 pp (24h). The cliff the docs draw exists in principle, but on this deployment it was a low curb you can hit at twice the rate without much effect. The axis that really split the results was not cardinality but retention: at the same rate, 24h retention cut the 95th-percentile time to first token (TTFT p95) from 106 seconds to 10. This note retraces that measurement as design → inputs → prediction vs. measurement → the curve → decision.
Why read this
Before you decide from the docs alone how many cache keys to use
Prompt caching serves same-prefix requests cheaply, so putting a long system prompt up front lets the requests behind it run at the cache rate. The trouble starts when they pile onto one key. The docs say one (prefix hash, cache key) overflows past roughly 15 requests per minute, and they steer you toward splitting prompt_cache_key into several buckets to spread the traffic.
But splitting has a price. Divide the key into 8 and each bucket's rate drops to an eighth, yet each bucket warms up that much less. In other words, the very split you made to dodge the limit can cool the cache instead. Which side wins is not something the docs answer — you have to measure it.
If you are weighing how many ways to split traffic with prompt_cache_key, this note is the closest match. To the question — “will splitting the key finely to dodge the docs limit protect the cache hit, or cost me in cold starts?” — this experiment gives one measured answer from a live deployment, and it is closer to ‘don't rush to split on the docs limit alone.’
First, 10 seconds
Don't take the conclusion on faith — print the numbers yourself
Token spend is zero. The first two lines print each retention mode's inputs, variables, and artifacts verbatim; the last line recomputes the cardinality 1-to-8 cache-hit change from the published aggregate CSV and checks it against this note (no network, no credentials).
# Print each retention mode's (in_memory · 24h) input -> variable -> artifact card (no network)
python3 -c "import experiments; print(experiments.describe('exp006_cache_key_bucketing_inmemory.yaml').summary())"
python3 -c "import experiments; print(experiments.describe('exp006_cache_key_bucketing_24h.yaml').summary())"
# Recompute cardinality 1->8 cache hit from the published aggregate CSV and check it against this note (zero tokens)
python3 -c "import csv; r=list(csv.DictReader(open('results/cache-key-bucketing/cache_hit_ratio_vs_cardinality.csv'))); d={(x['retention'],x['cardinality']):x for x in r}; [print('%-9s card1=%.4f%% (%.1f RPM/bucket) card8=%.4f%% (%.1f RPM/bucket) gap=%+.4f pp' % (ret, float(d[(ret,'1')]['cache_hit_ratio'])*100, float(d[(ret,'1')]['realized_admitted_per_bucket_rpm']), float(d[(ret,'8')]['cache_hit_ratio'])*100, float(d[(ret,'8')]['realized_admitted_per_bucket_rpm']), (float(d[(ret,'8')]['cache_hit_ratio'])-float(d[(ret,'1')]['cache_hit_ratio']))*100)) for ret in ('in_memory','24h')]"
Reproducing the live load needs Azure credentials and real spend — this is a genuine load test firing requests at a live deployment. The credential-free path (re-deriving the curves and CSVs from the published raw summary JSON) is written up in the chart-reproduction section of benchmarks/06-cache-key-bucketing/analysis.md and in scripts/plot_cache_key_bucketing.py.
Design
This time only the number of cache keys changes
Why we measured this. The docs' prescription is clear: one cache key overflows past about 15 requests per minute, so split the key into several buckets and spread the traffic. But splitting carries a counterweight — each bucket warms up less. Whether the ‘splitting gain’ or the ‘cooling cost’ is larger is not something you can read off the docs. This experiment actually weighs the two on a live deployment.
So the hypothesis rides on the size of the gap. The pre-registered reading has two branches — if cache hit climbs clearly from cardinality 1 to 8, bucket-splitting is a real capacity lever; if it barely moves, the docs limit is a smaller factor than policy choice on this deployment. Either way, the measurement picks the answer. We staked one side question on top: does 24h retention redraw that limit differently from the in_memory default?
To actually reach the limit, we first fixed our own rig. This experiment went through two false starts, and we are not hiding the record. The first sent requests serially, so the achieved rate sagged to about 7 per minute — it never even reached the docs limit of ~15. The second set the concurrency ceiling too low, so requests waiting to dispatch backed up in the dispatcher queue and a pre-registered backlog gate correctly aborted the run. Both attempts were quarantined out of the evidence, and only the final run — with the queue ceiling raised enough that a slow live response no longer clogs it — realized the planned 30 RPM (requests per minute). The numbers below are from that final run.
Why one live deployment. This is neither a simulation nor provisioned throughput unit (PTU, reserved-capacity) evidence — it is a PAYG (pay-as-you-go) measurement where every request hits a real Azure gpt-5.2 deployment (500,000 TPM, tokens per minute). The docs limit of ~15 RPM is on the PAYG model, so PAYG is the right place to measure it. The load is effort=low, a system prompt of about 9.5K tokens (pinned byte-for-byte across both retention modes with SHA-256 329a94…2a99, corpus_seed 4242), max_output_tokens=512. Requests flow steadily at 0.5 per second, and the steady-state slice (warmup excluded) is the representative window.
Exactly two axes vary — sweep.bucket_cardinality across {1, 8} and prompt_cache_retention across {in_memory, 24h}. Prompt, load, model, effort, and the deployment ceiling are all fixed, so the difference in artifacts comes only from those two axes. Each retention mode ran 480 requests × 2 cells.
There is one question. If you split traffic across several cache keys, do you drop below the limit the docs warn about and protect cache hit better?
Pre-registered prediction
Splitting the buckets will revive the cache. The registered decision line is the size of the cardinality 1→8 cache-hit gap — a clear climb means bucket-splitting is a real lever; barely moving means the limit is a minor factor on this deployment.
This experiment's role
The first reliable baseline of how hard the docs-stated cache-key limit really is on a live PAYG deployment. It checks whether cardinality and retention actually register on cache and latency.
Inputs and artifacts
What it consumed and what it left behind
The experiment's inputs and outputs are the repo's actual files, not a hand-written summary. So you can retrace it from input to output in a single line.
Input (in)
Experiment definitions: experiments/exp006_cache_key_bucketing_inmemory.yaml, …_24h.yaml (only prompt_cache_retention differs).
Corpus: system_prompt_corpus.json (about 9.5K tokens) · user_prompts.json.
Pinned: both runs' system prompt fixed by SHA-256 (329a94…2a99) — guaranteeing both retention modes got a byte-for-byte identical prompt.
Artifacts (out)
Raw calls: runs/*.jsonl (+ per-cell *.summary.json, with admitted-time telemetry).
Aggregate: analysis.md.
Curves: results/cache-key-bucketing/*.png·.csv (cache hit per cardinality, TTFT p95).
Each retention mode ran 480 requests × 2 cells to completion (one cell each at cardinality 1 and 8). The steady-state sample with warmup removed is about 388–390 records per cell. Across 1,920 sends in the evidence run, exactly 1 failed — a single upstream 500 for one instant, which cell isolation contained so the aggregates held. Real 429s (rate limits) were zero, and no cell backed up its dispatcher queue (all four report backlog_excessive=false). No rows were dropped — what was kept and why is covered under Transparency below.
Prediction vs. measurement
The prediction was ‘split and it survives’ — it barely moved
What we predicted
Pile onto one key and it overflows the docs limit and cools; split into 8 and it drops below the limit, so cache hit rises visibly. At minimum, this is where a clear step from 1 to 8 should appear.
What came out
Steady-state cache hit from cardinality 1 to 8 went in_memory 93.34% → 95.86% (+2.52 pp) and 24h 96.12% → 96.12% (−0.00 pp). A single key already took 30 requests per minute (twice the docs limit) and held.
Verdict: bucket-splitting was a weak lever on this deployment. Of the two pre-registered branches, the measurement chose ‘the gap is negligible.’ The ~15 RPM cliff the docs draw exists in principle, but on this PAYG deployment it was a low curb you can hit at twice the rate without much effect. The worry — “do I have to split the key to dodge the limit?” — has an answer here: at least at this scale, there is little reason to rush.
First signal
Splitting barely moved the cache
The table below is the steady-state slice (warmup excluded) — the window where the load has settled at 0.5 requests per second and the hypothesis applies. The numbers are re-cited from the published aggregate analysis.md and results/cache-key-bucketing/*.csv.
retention cardinality RPM/bucket steady cache hit TTFT p95 note
in_memory 1 (one key) 30.65 93.34% 106,390ms concentrated on one key · 2x the docs limit
in_memory 8 (split) 4.00 95.86% 16,624ms +2.52 pp (barely rises)
24h 1 (one key) 30.73 96.12% 9,900ms 24h retention · tail latency 10x shorter
24h 8 (split) 4.00 96.12% 15,549ms -0.00 pp (no change)
All four points sit packed inside the 93–96% band. Plotted, the line from cardinality 1 to 8 is nearly flat — even though we thinned the traffic to an eighth to dodge the docs limit, the cache hit gained just 2.52 pp in in_memory and essentially zero in 24h. The decisive point is the cardinality-1 side: that one key already took 30 requests per minute (30.65 / 30.73), which is twice the docs-stated ~15, and cache hit still held at 93.34% / 96.12%.
What did split visibly was the other axis, retention. At the same 30 RPM on cardinality 1, tail latency (TTFT p95) was 106,390 ms under in_memory but 9,900 ms under 24h — nearly a 10× difference. Cache hit was similar, but whether the hit arrived on time was decided entirely by the retention window.
bucket_cardinality (log2), the y-axis the steady-state cache-hit ratio. Both lines (in_memory · 24h) stay nearly flat from cardinality 1 to 8 — a single key held 93–96% while taking twice the docs limit (30 requests per minute), and splitting into 8 gained only +2.52 pp for in_memory and −0.00 pp for 24h. Each point is the warmup-excluded sample of the steady-state 480 requests (N=960/retention). Source: results/cache-key-bucketing/cache_hit_ratio_vs_cardinality.png.
Second signal
Why it was soft — one key was already hot enough
The reason the cliff was soft is simple: one key was already hot enough. At cardinality 1, all traffic enters a single common prefix. Thirty requests per minute is twice the docs limit, but that one key had short enough gaps between requests to stay warm without a chance to cool — hence the 93–96%. Split it into 8 and each bucket's rate drops to 4 requests per minute. That falls safely below the limit, but at the same time each bucket warms up less. The ‘gain from dodging overflow’ and the ‘loss from cooler buckets’ roughly cancel, so the net was 2.52 pp for in_memory and zero for 24h.
The retention results split because of the size of the window each mode keeps warm. 24h retention carries a wider key window warm across the whole cell. So even when a live response slows for a moment, it rarely has to recompute the prefix, and tail latency (TTFT p95) at cardinality 1 stays short at 9,900 ms. in_memory, by contrast, has to re-warm the prefix at each such moment, stretching the tail at the same point to 106,390 ms. The hit ratio was similar for both, but whether a hit was served promptly was decided by the retention window.
Cost barely moved. The evidence run cost in_memory $4.997211 and 24h $4.848757 — both similar (about $9.85 combined) — because the cache-hit difference across cardinality was too small to push meaningful input tokens back to full price. No cell backed up its queue (all four backlog_excessive=false), and concurrency peaked at just 33, far under the ceiling of 96. In other words these numbers came not from a clogged rig but from the planned rate actually being realized.
In short: the docs limit is a cliff in principle, but on this live PAYG deployment it was a low curb you can hit at twice the rate without much effect. Splitting the cache key finely, the ‘remedy,’ paid off little here; the real lever was retention — if you want to tame tail latency, turning on 24h worked far harder than touching cardinality.
Transparency
The smudges in the numbers, left as they are
No measurement is perfectly clean. We write down the marks this experiment left without erasing them — hiding them would only trip up the next person at the same spot.
- Zero rows dropped. Across 1,920 sends in the evidence run, exactly 1 failed (in_memory cardinality 1). One upstream request returned a
500for an instant, and the script's per-request failure isolation protected the rest of the cell. That cell still cleared the queue gate (backlog_excessive=false) and the concurrency ceiling (33 < 96). We left it in the aggregates as-is. - Two false starts were quarantined out of the evidence. Twice before, this experiment failed on its own rig — first it sent requests serially and never reached the docs limit, then its concurrency ceiling was too low and requests waiting to dispatch backed up the dispatcher queue, tripping a pre-registered backlog gate. Both were quarantined in separate folders with a ‘do not cite as evidence’ label, and the numbers above are from the fixed final run. We are not hiding them.
- The headline is steady-state. Mixing in the warmup transient, where the cache is still heating early on, would blur the policy effect — so we took the warmup-excluded steady-state slice (about 388–390 records per cell) as the representative number.
- No rate limits this time. The deployment had a roomy 500,000 TPM and the load stayed inside it (about 330K tokens per minute by the math), so real 429s were zero across all four cells. This note's talk of a ‘limit’ is about the cache limit, not rate limits.
Limits
How far to trust this
This result comes from one deployment, one capacity class, two cardinalities, one load profile, one run. It is safer to carry the method and the direction than the numbers themselves.
- PAYG, not PTU. The docs limit of ~15 RPM is on the PAYG (pay-as-you-go) model. PTU (reserved capacity) admits requests differently, so this result should not be carried over to PTU — this experiment did not measure PTU.
- Single deployment. No dual-deployment comparison, no spillover routing. It aims one lever — cache-key cardinality — on a live deployment.
- Absolute numbers don't transfer. Cache hit and latency shift with tenant, region, and time of day. Azure deployment load follows the clock, so read the direction of the difference across cardinality, not the absolute value.
- Tail latency varies widely. If the live deployment's TTFT distribution swings during a run, the numbers swing with it. We logged concurrency (
max_in_flight_observed) on every cell so you can confirm the values did not come from a clogged rig. - Load and sample. Two cardinality points per retention mode, 480 requests per cell. At this size we claim no confidence intervals or statistical significance — the direction is solid, but the absolute magnitude carries small-sample caution. Response quality was not scored.
- 24h cell isolation.
24hretention cannot wash the cache between cells, so isolation rests entirely on the per-cell namespace (an 8-char UUID suffix).
So what should the default be
Don't rush to split the cache key finely on the docs' ‘about 15 requests per bucket’ limit alone. On this live PAYG deployment, piling twice that limit (30 requests per minute) onto a single key still held steady-state cache hit at 93–96%, and splitting into 8 gained only 2.52 pp for in_memory and essentially zero for 24h. If your goal is to tame tail latency, reach for retention, not cardinality — 24h retention cut TTFT p95 from 106 seconds to 10 at the same rate. Keep cardinality splitting as the card you play when overflow is actually observed, and re-measure on your own deployment when the workload shape changes. And do not carry this conclusion to PTU — reserved capacity admits requests differently.
Building on
So the next person wanders less
Leaving evidence isn't only about recording the wins. An experiment whose prediction missed also has to record why it missed and how far to trust it, so the next decision can reuse it. That's why this note connects back to the spillover series and forward to a PTU measurement.
- Spillover series → exp004 and exp005 raced which deployment to route to under load; this note aimed at which cache key to route to (the bucket). Both are different handles on the same question — how do you keep the cache warm?
- Retrospective body → the hub's next verdict · next experiment previewed exactly this cache-tuning-handle measurement.
- Raw data → the two experiment definitions live in
experiments/exp006_cache_key_bucketing_*.yaml, and the analysis inbenchmarks/06-cache-key-bucketing/analysis.md.
Next experiment. This time we measured the cache-key limit on the PAYG model. Next it has to be seen on PTU (reserved capacity) — PTU admits requests differently, so whether PAYG's soft curb stays soft there is something you have to measure again.
Sources · evidence boundary
Sources & evidence boundary
This note, too, re-cites the published aggregate with no new measurement. The evidence and limits, including the single-PAYG-deployment boundary, are below.
- This experiment's analysis:
benchmarks/06-cache-key-bucketing/analysis.md(design summary, evidence-stage results, headline table, whether the limit is operationally reachable, limits). All figures are re-cited from there and fromresults/cache-key-bucketing/*.csv. - Experiment definitions:
experiments/exp006_cache_key_bucketing_inmemory.yaml·…_24h.yaml(onlyprompt_cache_retentiondiffers). - Methodology:
docs/05-methodology.md§8 (judge by effect size and direction, not statistical significance). - Azure docs: Prompt caching (
prompt_cache_keyand the prefix hash influence routing; overflow limit of about 15 requests/min per (prefix hash, cache key);24hretention;in_memorydefault · accessed 2026-05-29) · Rate limits & quota. - Pricing:
pricing/azure-openai-payg-2026-05.yaml(Azure, accessed 2026-05-19). gpt-5.2 = per 1M tokens input $1.75 / cached input $0.175 / reasoning $14.00 / output $14.00. - Boundary: one live
gpt-5.2deployment (500,000 TPM) · PAYG (not PTU) · custom sweep harness · 2 cardinalities × 2 retention modes · 480 requests per cell · no confidence intervals · no quality scoring.