Runbook: cache hit ratio collapsed
Symptoms: cgn:cache_hit_ratio_5m < 0.30 on a multi-replica
model, p99 TTFT spikes, GPU utilisation low (no prefix reuse).
Triage
-
Confirm it. No metric reports the hit rate, so read
overlapfrom the router's routing decisions (0to1, logged atinfo):kubectl -n cognitora logs <router-pod> | jq -r 'select(.fields.overlap != null) | .fields.overlap' | sort -n | uniq -cWas the model recently deployed? Cold starts always look bad for the first ~5 min; give it a window and re-check.
-
Check sticky routing:
cgn_cluster_node_queue_depthIf the load is fanned out evenly across nodes for a high-prefix- reuse workload, the score weights are off:
kubectl edit routingpolicy default # bump scoreWeights.kv to 0.7 (default 0.55), drop load to 0.15The router picks up the change in < 1 s via etcd.
-
Check kvcached health: Query the daemon's
Kv.StatsRPC for block counts and hit rates per tier.- Block count near 0 → the daemon restarted and lost its in-memory state. Expected; warms back in a few minutes.
- High miss rate on RAM with low miss rate on SSD → SSD is
holding the working set but the eviction policy on RAM is too
aggressive. Bump
[kv].ram_gib.
-
Check that prompts actually share prefixes. The most common "false miss" is a client adding a per-request system prompt timestamp. If
overlapstays near 0 for repeated prompts, compare the start of two prompts from your client. -
Check tenancy and tokenizers. Tenants don't share prefixes by design, so the same prompt from two API keys is a miss unless they share a
tenant:scope or[router].kv_tenant_isolationis off. Ifcgn_router_tokenizer_fallback_totalis rising, configure[models.*].tokenizerfor accurate chunking.
Knobs to twist (in order of safety)
routingpolicy.spec.scoreWeights.kv↑: favours nodes with the prefix already cached.[kv].ram_gib↑: bigger warm tier, fewer evictions.[kv].ssd_gib↑: bigger cold tier, fewer cold-disk fetches.[router.disagg].enabled = truefor prompts > 256 tokens: frees up decode-only nodes to retain their KV better.- (Last resort) Drop
[router.cascade]if it's enabled; the cascade can fragment prefix-sharing across model tiers.