18

I'm moving a domain's nameservers from the registrar to dnsmadeasy.com so that we can have automatic failover (among other benefits). When I've done this in the past I simply set the TTL value as low as it can go (1 minute) for the A record so that upon failure of the primary server the backup server is (nearly) immediately online.

The only issue that I can find with a low TTL is that we will have "higher query traffic". Is this a bad thing? Contrarily, are there benefits to using a high TTL value?

Charlie Schliesser
  • 430
  • 1
  • 4
  • 12
  • You can set it as low as you like - but any value less than around 3 hours will be treated as 3 hours (will vary depending on nameserver - NB not just the SOA nameserver) – symcbean May 11 '12 at 16:14
  • Can you elaborate? If I ping a domain with a 60 second TTL and switch the A record I see the new IP within 60 seconds. – Charlie Schliesser May 11 '12 at 16:20
  • 3 hours sound very worst case. I have seen scenarios where 5 minutes worked for all practical intents and purposes. – rackandboneman May 11 '12 at 16:59
  • Maybe the 3 hours is referring to a nameserver change as opposed to a record change. – Charlie Schliesser May 11 '12 at 17:10
  • No - typically NS records are retrieved an average of 3 servers away frmo the origin - the problem is the intermediate caching. Changes on your local server will be updated quite quickly, but from further away it can take much longer - but there is a huge variation in speed of update – symcbean May 14 '12 at 11:00
  • 1
    @symcbean Only a very shonky ISP would force a minimum 3 hour TTL. I'd advise any customer using such an ISP to leave and find a better one. – user1751825 May 06 '16 at 02:01

2 Answers2

10

High TTL means ISP and client-side DNS caches will last longer, which means your site will be more responsive for return visitors or folks who spend a lengthy time browsing your site in a single session.

Some providers also charge you on a usage basis for DNS lookups.

ceejayoz
  • 32,469
  • 7
  • 81
  • 105
  • 1
    Indeed on the charges – for example, dnsmadeeasy.com charges $29.99 / year for enterprise DNS that includes 5 million queries per month, then it's something like $1.85/million-queries/month after that. – Charlie Schliesser May 11 '12 at 17:09
8

You're right, the main disadvantage of using a low TTL is that you'll end up dealing with a higher query load than with higher TTL. That said, as long as your DNS host doesn't have any problems with handling the additional load, then go ahead. Honestly, if they had concerns about their ability to handle the load, they wouldn't let you set a very low TTL for your records (though many do tend to recommend that you set your TTL only as low as is necessary, which is a sound recommendation due to the user-experience point that ceejayoz made).

Additionally, I should mention that many ISPs DNS resolvers completely ignore the TTL setting and just set their own cache expiry on records, so for many cases, changing the TTL won't actually make any difference in the amount of queries that end up hitting the authoritative servers for your domain.

EEAA
  • 108,414
  • 18
  • 172
  • 242
  • Thanks for the detailed info. Regarding the ISP's DNS resolvers and my own experience: in this instance the domain is registered @ Network Solutions where the lowest TTL allowed is 1 hour. @ dnsmadeeasy.com we now have it set to 60 seconds at which point the site will point to a backup server in the event the cloud it's on has hardware failure. I've done this on one other site and had fantastic results; when the primary cloud failed, users (and all of the test machines and phones I've tried it on) immediately saw the backup site. Hopefully it continues to work this well. – Charlie Schliesser May 11 '12 at 16:18
  • "many ISPs DNS resolvers completely ignore the TTL setting" — what are those braindead bastards exactly? – poige May 11 '12 at 16:34
  • You're welcome. Consider yourself lucky if you've had good luck with DNS failover. This is one way to do things, but it typically doesn't work well (or it only works with an unacceptable delay). – EEAA May 11 '12 at 16:41
  • How else would you have IP failover? Even if IP x.x.x.x is setup as a routing gateway that determines which server delivers the requested content, if x.x.x.x has hardware failure you'll want something else to take its place immediately, right? – Charlie Schliesser May 11 '12 at 16:58
  • 1
    Look into BGP, and probably GSLB as well. – EEAA May 11 '12 at 17:02
  • "many ISPs DNS resolvers completely ignore the TTL setting" EVIL! – Paul Draper Jun 29 '14 at 07:37