Controlling Positive and Negative Caching

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_MACHINE\SYSTEM\CurrentControlSet\Services\DNSCache\Parameters 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).

Please or Register to post comments.

IT/Dev Connections

Las Vegas
September 30th - October 4th

Paul ThurottYou'll have the opportunity to experience:
• The Microsoft
Technology Roadmap
• Office 365 Implementation
• Hyper-V Optimizing
• Windows 8 Deployment
and much more!

Come See Paul Thurrott & Rod Trent in Person!

Early Registration Now Open

Upcoming Training

Mastering SharePoint 2013: Succeeding, Not Just Surviving

Building on the success of the “Mastering SharePoint 2010” seminars, the presenters have updated the content to cover the latest and greatest SharePoint product: SharePoint 2013. While SharePoint 2013 is relatively new on the marketplace, the presenters have been working with SharePoint 2013 for well over a year, and have implemented it with a number of clients in production environments.

Register Now

Current Issue

May 2013 - The NameTranslate object is useful when you need to translate Active Directory object names between different formats, but it's awkward to use from PowerShell. Here's a PowerShell script that eliminates the awkwardness.

CURRENT ISSUE / ARCHIVE / SUBSCRIBE

Windows Forums

Get answers to questions, share tips, and engage with the Windows Community in our Forums.