Domains, CDN & Web Delivery

DNS TTL

Definition

Time to live is a plain integer attached to every DNS record. A resolver that fetches the record is entitled to answer from memory for that many seconds, and it passes on the remaining time rather than the original figure — a record with a 3600-second TTL fetched 200 seconds ago is handed on with 3400 left. Common values are 300 for five minutes, 3600 for an hour and 86400 for a day, and some providers offer an 'automatic' setting that usually means a few hours. There is no single right number: a short TTL keeps you nimble and costs more lookups, a long one is cheaper and slower to correct. Since the value is per record, the busy ones and the stable ones can be treated differently.

Why It Matters

TTL is the length of your worst case. Point an A record at the wrong address with a day-long lifetime and anyone who looked before the mistake goes on reaching the wrong place for up to 24 hours, however fast you fix the zone. The cost of avoiding that is smaller than people assume: at 300 seconds, a site with 10,000 visits a day generates a few thousand extra lookups, each a handful of milliseconds on a cold connection and none at all once the resolver has it. The habit worth building is simple — drop to 300 a day before any planned change, do the work, then put it back once the new value has settled.

How It Works

You set the value in the same form where you set the record itself. The authoritative server returns it with every answer, the resolver counts down from there, and when it reaches zero the next query goes back to the source. Failures are cached too: a name that does not exist is remembered for the negative TTL taken from the zone's SOA record, which is why a hostname you created after somebody already tried it can stay missing for longer than the record's own value suggests. Some large resolvers also apply their own floors and ceilings, so a 30-second TTL may quietly be treated as a few minutes. None of this is negotiable from your side, which is another argument for setting sensible values early.

Real-World Example

Before moving a 12 MB manual to manual.hart.co.uk on 99helpers, the owner lowers the TTL on the existing record from 86400 to 300 and leaves it for a day. The move itself then takes minutes to be visible everywhere, and a rollback would take the same few minutes if the new address misbehaved. A week later, with the manual settled and the download analytics steady, they raise the record back to 3600 and stop thinking about it.

Common Mistakes

  • Setting a long TTL on a record you are about to change — the change then takes as long as the value you just saved, for everyone who looked first
  • Leaving everything at 60 seconds permanently — every cold visit pays for a fresh lookup and the agility buys nothing once the setup is stable
  • Overlooking negative caching — creating a record after visitors have already tried the name means they wait out the zone's negative TTL, not the record's

Related Terms

Put a file online in seconds

Drop in a document, an image, a page or a whole static website and share the link — free, with no build step and no server to set up.

Host a file free →