Try
↑ ↓ move↵ openesc close

CDN edge cache lab

Send skewed traffic through edge caches in front of an origin. Change the TTL, the cache key, the number of edges and a shield, and watch hit ratio, origin load and stale responses move.

tick 60TTL 60, 4 edges, clean keys100 distinct cache keys

The edge

requests
600
edge hit ratio
57%
origin offload
57%
average latency
88 ms

A hit is answered by the edge without a trip to the origin. Offload is the share of requests the origin never saw, so a shield can raise it without changing the hit ratio.

Freshness and the origin

origin requests
256
shield hits
0
stale responses
20%
served while refreshing
0

Stale means the copy served was older than the current version. A long TTL raises the hit ratio and the stale share together. A purge or a shorter TTL lowers the stale share and sends more to the origin.

Origin requests per tick and edge hit share, last 150 ticks
Origin requests per tick and edge hit share, last 150 ticks. Text version available below the chart.0510152013160recent ticksper tick

What to try

Each one sets up a starting point. Then make the change it describes.

  1. Longer TTL, fewer origin trips

    Raise the TTL from 10 to 300 and read the hit ratio and the stale share.

    Look for. The hit ratio climbs and the origin sees much less traffic. The stale share climbs with it, because a copy lives longer after the origin changes.

  2. A noisy cache key

    Switch the cache key to path plus tracking value.

    Look for. The same objects now have four cache entries each. Every entry fills on its own miss, so the hit ratio falls and the origin load rises with no change in what users ask for.

  3. Put a shield in front

    Turn the origin shield on and compare origin requests.

    Look for. The edge hit ratio stays where it was. The edges miss into the shield, and the shield answers many of them, so the origin sees far fewer requests.

  4. Purge instead of waiting

    Set the TTL to 300 and turn purge on.

    Look for. Stale responses drop to zero because a change deletes the copies. The cost is a few more origin requests, paid only when something changed.

  5. Stale while revalidate

    Turn stale while revalidate on and read the average latency.

    Look for. Users get the expired copy instantly while one refresh runs. Latency falls, and origin load stays the same because the refresh still happens.

  6. More edges, colder caches

    Raise the edge count from 4 to 8.

    Look for. Traffic spreads over more caches, so each sees fewer repeats of any object. The hit ratio falls and the origin load rises. A shield absorbs this effect.

New to the idea? Read the lesson first. Every number here comes from a seeded simulator, so the same seed gives the same run.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms