From the mailbag:
Q: How long does Chromium cache hostnames? I know a user can clear the hostname cache using the Clear host cache button on
about://net-internals/#dns, but how long it will take for the cache to be removed if no manual action is taken? After changing DNS records on my server,
nslookup from a client reflects the new IP address, but Edge is still using the old address?
A: tl;dr: Probably one minute.
Host resolution is surprisingly complicated.
DNS caching is intended to be controlled via a “time-to-live” value on DNS responses—each DNS lookup response is allowed to be cached for a time period it itself defines, and after that time period expires, the entry is meant to be deemed “stale”, and a new lookup undertaken.
DNS records get cached in myriad places (inside the browser, both literally—via the Host Resolver Cache, and implicitly– in the form of already-connected keep-alive sockets), in the operating system, in your home router, in the upstream ISP, and so forth. Using
nslookup to look up an address is a reasonable approach to check whether a fresh result is being returned from the OS’ DNS cache (or the upstream network), but it is worth mentioning that Chromium can be configured not to use the OS DNS resolver (e.g. instead using DNS-over-HTTPS or another DNS configuration).
If Chromium is using the System DNS resolver (the default on Windows), the cache entry should be fresh for 60 seconds— Chromium doesn’t know the DNS server’s desired TTL because getaddrinfo didn’t tell it.
// Default TTL for successful resolutions with ProcTask. const unsigned kCacheEntryTTLSeconds = 60;
Beyond treating entries older than their TTL as stale, Chromium also monitors “network change” events (e.g. connecting/disconnecting from WiFi or a VPN) and when those occur, the Host Resolver Cache will treat all previously-resolved entries as stale.
A Chromium net-export will contain details of the browser’s DNS configuration, and the contents of the browser’s DNS cache, including the TTL/expiration for each entry.