Support >
  About cybersecurity >
  DNS caching mechanism explained: Why do we need to wait for the modification record to take effect?
DNS caching mechanism explained: Why do we need to wait for the modification record to take effect?
Time : 2025-10-21 11:44:55
Edit : DNS.COM

  DNS is responsible for translating easily memorized domain names into computer-readable IP addresses. It's essential for nearly every website access, email, and API call. However, many people encounter a common problem after modifying their DNS records: Why does it take hours or even a day for my changes to take effect? ​​This is due to the DNS caching mechanism at work.

  I. Basic DNS Resolution Process

  When you enter a URL in your browser, the system goes through a series of queries:

  1. Browser Cache: The browser first checks to see if it has the IP address for the domain stored locally. If so, and it's not expired, it uses it directly without initiating a network request.

  2. Operating System Cache: If the browser doesn't have a cache, the query is forwarded to the operating system's local DNS cache, which can be viewed using the command ipconfig /displaydns in Windows.

  3. Local DNS Server: If the system also doesn't have a cache, the request is sent to the recursive DNS server provided by your Internet Service Provider (ISP), which searches for the result.

  4. Root DNS Server → Top-Level Domain (TLD) DNS → Authoritative DNS Server: If the recursive server doesn't have a cache, it will query the authoritative DNS server layer by layer until it obtains the latest record.

  The entire process may seem complex, but it typically takes only tens of milliseconds. The key point is that each query node may cache the result to improve resolution speed. This means that even if you update the record, the old cache will still exist in each node for a period of time.

  II. The Core of the DNS Caching Mechanism: TTL Value

  TTL is the core parameter of the DNS caching mechanism. It defines the time, in seconds, that a DNS record can remain in the cache. For example, TTL = 3600 means the record will be cached for 1 hour; TTL = 86400 means it will be cached for 24 hours; TTL = 300 means it will be cached for 5 minutes.

  When the TTL countdown reaches zero, the cache node (whether it is a browser or a DNS server) will query the next higher level for the latest record. Therefore, the reason you have to wait for DNS record changes to take effect is because the old cached TTL hasn't expired yet.

  For example, if your domain's A record originally had a TTL of 86400 seconds, you might still be resolved to the old IP address if you access it immediately after the change. Only after 24 hours have passed and the cache has expired will the new IP address be gradually updated by global DNS nodes.

  III. The Cumulative Effect of Multi-Layer Caches

  The DNS cache isn't just one layer; it's a layered system. Each layer of cache maintains its own timer, resulting in differences in the time it takes for updates to take effect.

  1. Browser Cache: Browsers (such as Chrome and Edge) cache locally based on the TTL returned by the system's DNS server. Some browsers may also set an additional minimum cache time.

  How to Clear the Cache: You can clear the cache by restarting the browser or entering chrome://net-internals/#dns in the address bar.

  2. Operating System Cache: The system-level cache also stores recently resolved results.

  Clearing Method:

  Windows: ipconfig /flushdns

  macOS: sudo killall -HUP mDNSResponder

  Linux: Restart the systemd-resolved service.

  3. Local Recursive DNS Server Cache: This is often the most impactful layer, as ISPs around the world cache records for popular domain names. If a user's DNS server cache hasn't expired, they'll still access the old address even if the authoritative server has been updated.

  4. Authoritative DNS Server No Cache: Authoritative servers only store the latest authoritative records and don't cache any higher-level information. Therefore, any updates to this layer take effect immediately.

  In summary, the time it takes for DNS changes to take effect network-wide depends on the TTL expiration status of all cache nodes.

  IV. TTL Setting Strategy: Balancing Speed ​​and Control

  Setting a TTL that is too long will result in delayed changes; setting it too short will increase query load and latency. Enterprises should flexibly choose the right one based on their operational scenarios.

  Before migrating a website or switching servers: We recommend reducing the TTL to 300 seconds (5 minutes) 24 hours in advance, then restoring it to its original value after the migration is complete. This will ensure faster implementation of the switch.

  In stable production environments: You can set a longer TTL (e.g., 86400 seconds) to reduce DNS queries and improve access efficiency.

  In load balancing or dynamic resolution scenarios: We recommend setting the TTL between 60 and 300 seconds to quickly respond to node changes.

  V. Why do the implementation times vary in different regions?

  Many people may find that accessing the old IP address in China displays the new IP address when accessing from abroad. This is because recursive DNS servers in different regions refresh their caches at different times. Some adhere to the authoritative server's TTL, while others may even "arbitrarily" extend the cache time to reduce load.

  In addition, while some public DNS servers update relatively quickly, some carriers' DNS update cycles may be longer. This results in DNS propagation delays—it takes time for the same record to be fully synchronized globally, typically ranging from several hours to 48 hours.

  VI. Common Questions and Misconceptions

  Question 1: The change took effect immediately. Does this mean the cache isn't working?

  No. It's possible that the DNS server you're accessing doesn't have the old record cached, or the TTL has expired, so it's directly retrieving the latest resolution.

  Question 2: I changed the record, but others are still accessing the old IP address.

  This is usually because the cache of the DNS node they're using hasn't expired, and it has nothing to do with the website itself. The waiting time depends on the previous TTL length.

  Question 3: Can the DNS cache be forced to refresh?

  Records on authoritative servers can be updated immediately, but the caches of recursive DNS nodes cannot be forcibly cleared; they must wait until the TTL expires.

  Question 4: Is CDN also affected by DNS caching?

  Yes. CDN services are typically based on CNAME resolution and also rely on DNS. If the CNAME cache hasn't been updated after changing the origin server's IP address, users may still access the old node.

  Summary: Caching isn't about latency; it's about efficiency. Many people find DNS caching troublesome because of the waiting time after making changes. However, caching is the foundation of DNS's high-performance operation. Without caching, every website access would have to be resolved from the root servers, exponentially increasing global network load and significantly reducing access speeds. DNS caching is a balance between real-time performance and performance. Understanding the meaning of TTL and planning changes in advance can make website migrations and resolution adjustments more manageable.

DNS Jude
DNS Sugar
DNS Amy
DNS Grace
DNS Luna
DNS Puff
DNS Becky
DNS NOC
Title
Email Address
Type
Information
Code
Submit