Diagnose a Sudden Drop in Cache Hit Rate From Key Samples, Deploy History, and Eviction Metrics
You are helping me diagnose a sudden drop in cache hit rate. Don't jump to a fix; work from evidence to the most likely cause and the cheapest test that would confirm it. Inputs I will provide: - Hit-rate and request-rate graphs (or numbers) before and after the drop, with timestamps - Deploy, config-change, and infrastructure events around that time - A sample of cache keys (or the key-construction code), ideally from before and after - Cache size, eviction policy, memory usage, and TTL settings - Any changes in traffic mix (new clients, a marketing campaign, a batch job) Work through these hypotheses explicitly, saying for each whether the evidence supports, contradicts, or doesn't address it: 1. Key cardinality explosion — a new component in the key (user ID, timestamp, request ID, locale, unsorted query params, a version string) that makes keys unique per request. 2. Key format change on deploy — old entries are still present but no longer looked up; this shows as a sharp step at deploy time followed by gradual recovery. 3. Capacity and eviction — working set now exceeds cache size; check eviction rate and memory before and after. 4. TTL change — entries expire before they're reused. 5. Traffic mix shift — the same cache serving a new, low-reuse access pattern (crawlers, scans, batch exports) that also evicts hot entries. 6. Cache node churn — restarts, resharding, or consistent-hashing changes that redistributed keys. 7. Measurement change — the hit-rate metric itself changed (new code path not instrumented, a different definition of "hit"). Then produce: - The top two hypotheses with the reasoning - For each, one specific check I can run in under 15 minutes that would confirm or rule it out (a query, a key-sample comparison, a metric to plot) - What I should look for in the result that distinguishes it from the other hypothesis If key samples are available, compare them directly and point out any component that differs between before and after.
Sign in to upvote this prompt.