TTL: how long records are remembered

ttl, dns, cache, propagation, seconds · 0 found this helpful

TTL stands for time to live. It is a number of seconds that tells resolvers how long they may remember a record before asking again.

Common values

TTL (seconds) Time Use
60 to 300 1 to 5 minutes Before and during a move
3600 1 hour A good default
14400 4 hours The default on records we create
86400 1 day Records that almost never change

How it behaves

Resolver A looks up example.ca at 9:00 and gets 203.0.113.25 with a TTL of 3600. It keeps that answer until 10:00. If you change the record at 9:05, Resolver A still returns the old address until 10:00. A resolver that has never looked up the name gets the new one at once.

The wait is at most the old TTL. If the old TTL was 86400, some visitors see the old value for a day.

Low versus high

Low TTL High TTL
Changes take effect Quickly Slowly
Load on nameservers More queries Fewer
Speed for visitors Slightly slower first lookup Slightly faster
Good for Records you expect to change Stable records

Plan a change with a TTL

  1. A day or two before, edit the records you will change and set the TTL to 300.
  2. Wait at least as long as the previous TTL.
  3. Make the real change.
  4. When everything works, set the TTL back to 3600 or higher.

Do this for an IP change, an email provider move, or a website move.

Set it in your Barbrick account

  1. Open Account → Hosting → your site → DNS. If you have more than one domain, choose it under Domain and click Show.
  2. Click the pencil at the end of the record's row.
  3. Change TTL and click Save record. The choices are 5 min, 1 hr, 4 hr and 1 day.

See the TTL that is being served

dig example.ca A
;; ANSWER SECTION:
example.ca.       3600    IN    A    203.0.113.25

Ask the same question twice at a public resolver. The number counts down while it is cached.

dig example.ca A @1.1.1.1
example.ca.       2743    IN    A    203.0.113.25

Nameserver changes

The delegation TTL for the NS records is set by the registry, not you. It is often 24 to 48 hours. See DNS propagation.

Negative caching

A resolver also remembers that a name does not exist. If you look up a record before you create it, the "no" is cached. That is why a brand-new record can seem missing for a few minutes. The SOA record sets that time.

Was this helpful?

Still stuck? Ask us and we'll walk you through it.