DNS & Naming

the DNS time-to-live

Every DNS record carries an expiry timer called its time-to-live, or TTL — a number of seconds telling anyone who caches it how long they are allowed to keep using the copy before they must look it up fresh. Think of a sticky note with best before written on it: while the time is good, reuse the note; once it expires, throw it away and ask again. The TTL is how the owner of a name controls the trade-off between speed and freshness.

Concretely, the TTL is set per record by the zone's administrator, and it is a number of seconds — values like 300 (5 minutes), 3600 (1 hour), or 86400 (1 day) are common. When a resolver caches the record, it counts down that TTL; while it is still positive, the resolver answers from cache, and when it hits zero the resolver discards the entry and will fetch a fresh copy next time. Note the TTL does not mean the record changes every so often — it only governs how long a cached copy may be trusted.

Why it matters: TTL is the dial behind DNS propagation. A long TTL means lookups are fast and authoritative servers see little load, but a change takes that long to spread because old copies linger. A short TTL makes changes propagate quickly but costs more lookups and load. The practical playbook before a planned migration is to lower the TTL well in advance (say to 60 seconds), make the change, then raise it again once everything is stable. A common misconception is that you can force the whole world to update instantly — you cannot reliably; caches honor the TTL that was in effect when they fetched the record.

An A record set with TTL 3600 is fetched at 12:00. A resolver may serve that cached address until 13:00 without rechecking. If the owner changes the IP at 12:10, resolvers that cached it at 12:00 keep handing out the old IP until their hour is up.

TTL is the lifetime of a cached copy, set by the record's owner.

Lowering a TTL only affects copies fetched after the change; copies already cached run out on their old, longer TTL. So you must lower the TTL and wait for the old one to expire before the short window takes effect.

Also called
TTLtime-to-liverecord TTL存活時間