Using Time To Live to manage migrations

Posted: March 26th, 2018

 

Moving services from one node/location to another will most likely involve a DNS change. Time to Live (TTL) can help minimize the impact of such a change.

 

TTL is the expiry time of the DNS record. Most websites will have a TTL of 86400 (seconds) or one day. This means that once a DNS server or other DNS client has requested the record it will maintain a cached copy of the site for up to a day before re-requesting it.

 

If you leave your TTL at 86400 and change the DNS entry to point to your new server it could take up to one day for the change to take place.

 

Setting up quick DNS switchovers for migrations

 

If you have a TTL of 86400 make sure you reduce it before you want to perform the migration.

 

You can change the TTL to 3600 (1 hour) the day before the planned migration. One hour before the migration time, reduce the TTL to 600 seconds (10 mins). At least 10 mins before, adjust it down to 60 seconds.

 

Once you make the change, traffic be sent to the new IP address. If anything goes wrong you can change the entry back and all traffic should fail back within a minute.

 

Once you are confident all is working as it should from the new server, increase the TTL back up to it’s normal setting.