Controlling Positive and Negative Caching

Douglas Toombs

November 21, 2005

2 Min Read
ITPro Today logo in a gray background | ITPro Today

Controlling Positive and Negative Caching
Windows caching occurs according to default time periods, depending on which version of Windows you're using and how it's configured. You can control this caching behavior by manipulating the values of two registry keys. The HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesDNSCacheParameters subkey holds the values, which let you adjust the length of time that positive and negative responses are stored in the cache. These values are slightly different in Windows Server 2003, Windows XP, and Windows 2000.

For positive caching in Win2K, the value is MaxCacheEntryTtlLimit , and in XP and Windows 2003 the value is MaxCacheTtl . Each value refers to the maximum number of seconds that a positive DNS response should be stored in cache. If the key exists on your system, the default value is likely 86,400 seconds (1 day). This value will override any TTL values provided in a DNS response that might be greater; therefore, the maximum time that Windows will cache a positive response (by default) is 1 day, even if the TTL in the response is set for 5 days. By setting this value to 1 second, you can effectively negate the effects of positive caching of DNS lookups on your system.

For negative-response caching in Win2K, the value is NegativeCacheTime , and in XP and Windows 2003, the value is MaxNegativeCacheTtl . The default value is 300 seconds (5 minutes) in Win2K and 900 seconds (15 minutes) in XP and Windows 2003. Negative responses returned from a DNS server will be cached for this time interval, and any future queries—even if a host suddenly has a valid record where it didn't before—will fail with a negative response until the cache timer runs out. As you're bringing new systems online, negative caching can definitely be troublesome if you attempt to resolve the name before it's available on the network.

You can find more information about these procedures in the Microsoft articles “How to Disable Client-Side DNS Caching in Windows 2000” (http://support.microsoft.com/default.aspx?scid=kb;en-us;245437) and “How to Disable Client-Side DNS Caching in Windows XP and Windows Server 2003” (http://support.microsoft.com/default.aspx?scid=kb;en-us;318803).

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like