4. DNS
4.7 Why do DNS changes "take time to propagate"?
In your phone's contacts: When Ravi changes his number, nothing is sent to you. You just keep the old number until you happen to check again. Everyone updates at a different time, depending on when they last saved it.
In the system: "Propagation" is a misleading word. Nothing is pushed anywhere. You change the record on your authoritative server instantly, but every resolver that cached the old answer keeps using it until its TTL runs out. Users switch over one resolver at a time.
Figure: with a 1-day TTL, some users reach the old server for up to a day after the move. Lowering the TTL in advance shrinks that to minutes.
How to move a site to new servers safely:
- Lower the TTL early. At least one old-TTL period before the move (if the TTL was 1 day, lower it to 300 seconds more than a day before), so the long-lived copies expire.
- Change the record at the planned time.
- Keep the old servers running until the old TTL has passed, and ideally a little longer: some resolvers and apps hold answers longer than they should.
- Raise the TTL again once everything is stable.
Changing a domain's name servers (moving to a new DNS provider) is slower still, because the NS records at the TLD often have long TTLs of their own.
Memory code: "DNS doesn't spread, old copies expire. Lower the TTL before you move house."