Cache Sizing Lab

Replay your own access log through eight eviction policies and see how many cache entries you actually need. The dashed line is the theoretical best (Belady OPT), so you can tell whether a smarter policy is worth it or the workload is simply hopeless.

Runs in your browser No upload, no login

1. Workload

Use a synthetic pattern, or paste a log with one cache key per line (URL, user id, object id, block number). CSV and TSV work too: pick the column. Your data stays in this tab.

When each key shows up

X is request number, Y is the key's first-seen order. A diagonal streak is a scan, a dense band at the bottom is a hot set.

How skewed it is

Requests per key, most popular first, both axes logarithmic. A steep slope means a small cache goes far.

2. Hit ratio vs cache size

Cache size counts entries (every key counts as one slot), from 1 up to the number of distinct keys.

The thin horizontal line is not a policy: the ceiling is the best any cache could do, because the first request for every key always misses.

3. How big a cache do I need?

Pick the hit ratio you want. Sizes are interpolated between the simulated points.

What the numbers say

    4. Watch one policy decide

    A tiny cache and a short sequence, one request at a time. Try the default (a classic sequence where FIFO does worse with more room), then paste your own keys.

    Same sequence, every policy