When you are switching to a new website, it's normal to ask yourself - "Is the transition going to make the site unreachable?"
The short answer is No. In this article, we are covering the details of the transition and especially the process of dealing with the DNS transition, which can sometimes be worrying.
What is a DNS and Why is it Used?
DNS stands for Domain Name System and it is responsible for converting human-friendly domain names into IP addresses (for example: google.com is converted to 172.217.23.110).
When a user types a domain name into a browser (ex google.com), the DNS translates the domain name into an IP address. Then, browsers use this address to locate the data on CDN edge servers or origin servers. Once the content has been found, it will appear on your screen.
In short, a DNS is like the internet’s phonebook that pairs names with numbers.
How Long Does DNS Migration Take?
Just like changing your address in real life, it takes time to move a DNS to a new server.
Systems need to adjust to the new server’s location to be able to direct users to the correct data. This period of readjustment is known as Propagation.
Typically, propagation takes anywhere from a few hours to a full day. This is because nameservers and CDN edge servers need to store new caches that link to your new host.
Propagation can be a stressful time for your business because some users may be directed to inactive addresses.
However, we can minimize the number of users who are unable to access your content during propagation.
What actions do we take to ensure a smooth transition?
- Reduce the DNS TTL Cache for the domain to 300s a few days before going live.
DNS TTL (time to live) is a setting that tells the DNS resolver how long to cache a query before requesting a new one. The information gathered is then stored in the cache of the recursive or local resolver for the TTL before it reaches back out to collect new, updated details.
For example, if the DNS TTL is set to 300 seconds (5 mins), the resolver will have to regather the details around a website like google.com every 5 minutes. If 100 users visit the site in that period, they will all see the same thing, until the resolvers update their TTL.
A low TTL is used only during migration because it can be resource-intensive.
2. Ensure that the right domains are set
We need to always make sure that both simple domains and www-prefixed domains are properly set. (ex. www.google.com and google.com should be set)
3. Make sure that both Front-end and Back-end domains are pointing to the right address
Since the website uses 2 domains, one for the front end and one for the back-end, we always ensure that both of them point to the right IP.
4. Transition using IP and CNAME
We support DNS transition during a launch using either IP or CNAME.
5. Remove the htaccess protection
Before launching a website, we are offering our clients a pre-production site that is protected. We ensure that protection via htaccess. Only someone who has the username and password will be able to access the staging site.
When we are launching a website, the protection remains. We must remove it so everyone can access the website after launch.
6. Regenerate the SSL certificates
Once everything is properly set up, we are also regenerating the SSL certificates to make sure that the website has all the right certificates.
How Long Will It Take for the DNS to Update?
To know that everyone is seeing an updated DNS record, it is essential to calculate how long it will “actually” take to propagate across DNS. This is accomplished by using the following formula
TTL X (number of steps) = Fully propagated
Realistically we expect the number of steps to be at most 2.
For example, if your set TTL is 300 seconds and there are two steps (not counting the authoritative server), then your absolute worst case of fully propagated time would be 600 seconds or no longer than 10 minutes. Realistically after two times the TTL all DNS servers have updated their records, which would be 600 seconds (=10 minutes).
Is the previous site still accessible during the transition?
During the transition the previous site is still reachable and there is no downtime.
However, because the previous site is reachable, we always recommend that the website doesn't accept new data (ex. Registration is stopped), to avoid the case that the data is stored in the previous site and is not available on the new one after the transition is complete.
After the migration is completed, we recommend keeping the TTL to 300s for a couple of days and then switching it to 1 hour (3600 seconds) afterward.