Try
↑ ↓ move↵ openesc close
In this lesson · topic 3 of 7
  1. 1. One origin, every user
  2. 2. Hit, miss and the TTL
  3. 3. Move the TTL and watch the origin
  4. 4. A noisy key, a cold edge, a stale page
  5. 5. Cache keys and purging
  6. 6. Stale while revalidate and the origin shield
  7. 7. Edge caches in review

Topic 3

Move the TTL and watch the origin

8 min read

What the lab runs

Ten requests arrive each tick for 100 objects. Popularity is skewed, so a handful of objects take most of the traffic. Each request lands on one of the edges at random. An edge keeps a copy for the TTL you set. Every tick there is a chance that one object changes at the origin.

The lab shows the edge hit ratio, how many requests reached the origin, how many responses were older than the current version, and the average latency. A hit costs 20 ms, a shield hit 60 ms, and an origin trip 180 ms.

Predict before you press play

You raise the TTL from 60 to 300 ticks. What happens to the hit ratio and to the share of stale responses?

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

Full-page version with guided experiments: CDN edge cache lab.

Things to try

  1. Set the TTL to 300 and read the hit ratio and the stale share.
  2. Switch the cache key to path plus tracking value.
  3. Turn the shield on and compare origin requests.
  4. Set the TTL to 300 and turn purge on.
  5. Raise the edge count from 4 to 8.

The full-page lab has a guided experiment for each of these, and for stale while revalidate.

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