Posts Tagged 'TTL'

June 26, 2007

TTL and propagation

Every DNS record is equipped with a TTL. The TTL (Time To Live) is basically the expiration date on that record. Long story short, it's a countdown from when it was initially received until when it is marked as invalid and discarded for a replacement record. This is a very important piece of information that I've run into often as being either outright ignored or misunderstood.

Let's say you have a domain-something awesome like has a TTL of 24 hours. When I go to visit as a new visitor (and you know I would, because it sounds awesome) I'm going to receive a record translating to an IP address that will be valid for 24 hours. Any other time I visit that domain in the next 24 hours, I'm going to use that cached address because the record hasn't expired yet. In 24 hours regardless of if has moved IPs, I'm going to trash that old DNS record I've cached locally and go look it up again. The new record will then be referred to by me for the next 24 hours, at which time I'll do it all over again.

But what happens when you have to change your IP, but you want your visitors to see the smallest amount of downtime possible? My first suggestion is to mirror your sites on both IPs, but that is a different discussion entirely. The second is to manipulate your TTL. First lower it to something smaller-from a day to an hour perhaps. Then give that new record with that new TTL at least 24 hours to propagate. Now you can be certain that at the 25th hour, all of your visitors now have a record that will expire in one hour. Next, change your IP for, the record that your visitors have cached locally will expire in an hour, and then they will have your new record with your new IP. Feel free to bump your TTL back up to what it was originally in this step, since they have the new IP. Now your visitors have only had an old record for an hour rather than 24, and they probably missed that hour it was inaccessible while they were posing for a painting or having their top hats heightened. Because all of your visitors are terribly classy.


Subscribe to ttl