Freshness

Freshness is the age of the data that a reader sees. A DNS answer lives 300 s by default, so after a server fails, some clients keep its old address for up to 5 minutes. A shorter time to live gives newer answers but causes more lookups.

Play a level

See it on the board

The same traffic runs on two boards. The simulator measured both when this page was built.

Board to show
DNSHTTP/2HTTP/2UsersDNS1 vCPU · 1 GBAPI server1 vCPU · 1 GBAPI server1 vCPU · 1 GB
DNSHTTP/2HTTP/2UsersDNS1 vCPU · 1 GBAPI server1 vCPU · 1 GBAPI server1 vCPU · 1 GB
DNS time to live of 300 s: misses a goal
DNSHTTP/2HTTP/2UsersDNS1 vCPU · 1 GBAPI server1 vCPU · 1 GBAPI server1 vCPU · 1 GB
DNSHTTP/2HTTP/2UsersDNS1 vCPU · 1 GBAPI server1 vCPU · 1 GBAPI server1 vCPU · 1 GB
DNS time to live of 1 s: meets the goals
See it on the board
Measure Goal DNS time to live of 300 s DNS time to live of 1 s
Availability at least 97% 58.8% Fail 98.4% Pass
p99 latency under 200 ms 25 ms Pass 25 ms Pass
Monthly cost 12 USD/mo 12 USD/mo
Error rate 41.2% 1.6%

Key numbers

Default part values from the catalog. The simulator uses the same values.
NumberValue
DNS answer time to live, default300 s
Cache entry time to live, default60 s
CDN file time to live, default3,600 s
Database replica lag, default0.1 s
Time between DNS health checks10 s
Answers with a time to liveDrag or use arrow keys to change the TTL

TTL 5 minutes · 12 lookups/h · old answers up to 5 minutes

How it works

Every copy of data starts to age as soon as it is made. A cache entry, a DNS answer, a CDN file and a database replica are all copies. Each one has a rule for how long it may live before a reader must get a new version.

The time to live, or TTL, sets that rule. A long TTL means fewer lookups and less load on the source, but changes reach readers late. A short TTL makes changes visible fast, but each reader asks the source more often. With a 1 s TTL, every client can ask again each second.

Not all data needs the same freshness. A price at checkout, an account balance or a failover address must be new. A product picture or a page footer can be minutes old. Choose a TTL for each kind of data, and remove an entry on write when old data is not acceptable.

Replicas age too. A database replica that is 0.1 s behind can show a value that the primary has already changed.

In the levels you set time to live values and decide how old each answer may be.