locked
IIS 6.0 Caching of UNC documents RRS feed

  • Question

  • User-67419931 posted

    Hi,

     I'm not having much luck resolving a caching issue with documents located on a novell file server.  We have a virtual directory setup in IIS that points to a CIFS share on a novell server.  When the document contents are updated, the changes do not always display instantly when viewing the document through our web-site.  When I browse to the document through IIS, the last modified timestamp is correct, however when I open the file right from IIS the content is stale.

     Sometimes the served document is updated instantly, but the majority of the time it takes several minutes, sometimes close to a day to update.
     

    I've tried numerous registry changes, none of which have worked.  Listed below are some of the changes I have attempted. I tried each reg change separately. I restarted IIS after each attempt.
     

    Inserted the following entries into [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\InetInfo\Parameters]

    -DoDirMonitoringForUNC = 1
    -EnableChangeNotificationForUNC = 1
    -FileAttributeCheckThreshold = 1
    -FileAttributeCheckThreshold = 1
    -DisableMemoryCache: REG_DWORD: 1

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ASP\Parameters\

    -FileMonitoringTimeoutSeconds = 5

    *Also enabled content expiration for http headers.

     

    Any help or suggestions would be greatly apperciated.

     

    Thanks,

    Wes
     

    Tuesday, July 15, 2008 3:42 PM

Answers

  • User1073881637 posted

    It appears you are bumping up against built-in caching features in IIS that help with performance.  Here are a couple article links that might help provide some ideas.  Hope this helps.

    http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/f0cd5c87-fbc9-4ba0-9c2b-633c776b05d5.mspx?mfr=true

    http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/f0cd5c87-fbc9-4ba0-9c2b-633c776b05d5.mspx?mfr=true

    'This is probably the standard for remote content and IIS 6. 

    http://www.microsoft.com/technet/prodtechnol/windowsserver2003/technologies/webapp/iis/remstorg.mspx

     

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, July 16, 2008 6:16 AM
  • User10285400 posted

    We really do need a separate KB article to articulate this more clearly.  This information is in the whitepaper, but obviously not clear enough. 

    You need to turn the "notification-based" caching off on IIS to get this to work.  You need to do this for the Static file cache and for the ASP file cache.  For asp.net (and other application content) turn caching off altogether. 

    To turn off this "notification-based" caching for IIS (in other words, use a polling method to check the last-modified timestamp instead):

    <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>

    • Static Pages

    Set the registry property, DoDirMonitoringForUNC, a DWORD value located at HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Inetinfo\Parameters, to False or 0.

     <o:p></o:p>

    • ASP Scripts

    Set the registry property, EnableChangeNotificationForUNC, a DWORD value, located at HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\ASP\Parameters to False or 0.

     

    By the way, this is the default behavior (AFAIK), so if you were to remove the registry keys that you have set you'd be in a lot better shape. 

     

    The key you might want to twiddle with is the latency on the last-modified time check (default of 5 seconds).  The doc says:

     

    For some sites, a five-second window will be too large a window, and for others, too small. The sampling interval is configurable with the following registry keys, which are not present by default:

    Static pages Set the registry property, FileAttributeCheckThreshold, a DWORD value, located at HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Inetinfo\Parameters.  If the DoDirMonitoringForUnc registry property, a DWORD value located at HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Inetinfo\Parameters, is set to False, IIS checks the cache entries for change after a period of time equal to the value set for the FileAttributeCheckThreshold registry property. Effective with Windows Server 2003 SP1, IIS checks both the worker process file cache entries and the HTTP.sys cache entries.

    ASP Scripts Set the registry property, FileMonitoringTimeoutSeconds, a DWORD value, located at HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\ASP\Parameters.

    Using the last-modified cache update mechanism will result in more reliable and secure delivery of content. Additionally, it will scale well on a wide application structure (where your Web server has lots of applications pointing at thousands of different directories). There is, however, a performance penalty that may be noticeable in regards to static content. 

    Hope that helps!

     

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, July 16, 2008 1:36 PM
  • User1073881637 posted

    For a situation like this, I would tear down your environment (or build another one) to truly understand which registry entries made the difference. .  Going forward, you know and can explain it.  Understanding something unique like this (it's not a common thing using Novell's CIFS server as a content server in IIS althought there is nothing wrong with it either),  The better you understand the environment, the easier is should be to support.  I think it's cool you are using the two environments together, you get the best of both worlds.  I appreciate you publishing your updates, this helps others and is interesting.

    On a side node, if I wanted to test this on my own, would using a linux box with SAMBA represent something similar?

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Friday, July 18, 2008 6:37 AM
  • User-67419931 posted

    I'm certain I wouldv'e experienced the caching issue by now. So the last changes I made resolved the problem.

     Steve,

    I agree that tearing down the environment is a good idea.  But in terms of time, I don't think that is an option.  Any time I tried new registry changes, I removed the testing entries and also ran a .reg backup that was made before I began initial testing.  I have another envionrment besides Prod where I will test just the changes below before implementing these changes in real-time.  I will keep you guys update.

     I can confidently say that the registry changes I applied below to disable change-notification caching and tweak the last-modified settings worked.

     

    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Inetinfo\Parameters

    -DWORD DoDirMonitoringForUNC (0)
    -DWORD FileAttributeCheckThreshold (1)

    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\ASP\Parameters

    -DWORD EnableChangeNotificationForUNC (0)
    -DWORD FileMonitoringTimeoutSeconds (1)

    I haven't used the SAMBA protocol, but from what I understand it's file sharing ability is based on that of CIFS.  Since the caching mechanisms are defined within IIS, this should work for any remote file server that is accessed through IIS via UNC path.

    Thanks all.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Friday, July 18, 2008 11:09 AM

All replies

  • User1073881637 posted

    It appears you are bumping up against built-in caching features in IIS that help with performance.  Here are a couple article links that might help provide some ideas.  Hope this helps.

    http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/f0cd5c87-fbc9-4ba0-9c2b-633c776b05d5.mspx?mfr=true

    http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/f0cd5c87-fbc9-4ba0-9c2b-633c776b05d5.mspx?mfr=true

    'This is probably the standard for remote content and IIS 6. 

    http://www.microsoft.com/technet/prodtechnol/windowsserver2003/technologies/webapp/iis/remstorg.mspx

     

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, July 16, 2008 6:16 AM
  • User-67419931 posted

    Thanks for the reply Steve.  I've been going through the links and haven't been able to find a setting that works.  Some of the registry configs mention IIS may need to be tweaked to handle the amount of requests for remote files.  The demands/requests for the UNC docs in my situation is fairly low.  I have a test environment I'm testing this in as well, and the issue still occurs when I am the only one on the system attempting to update a document.  The content being served is still stale.

     I've checked with the novell server admin and there is no CIFS caching setup.  I know it is IIS but can't pinpoint what needs to be modified.

    Wednesday, July 16, 2008 11:00 AM
  • User1073881637 posted

    You're welcome.  I'm not certain what else to recommend.  Most of the registry keys and related to UNC are using change file notification tied into Windows.  Since this is a non-MS OS, I'm not certain what to suggest.  I can check around and see if I can find anything.  If I get a response, I'll post back.  You are doing the right thing by isolating in a test environment.

    Wednesday, July 16, 2008 12:27 PM
  • User10285400 posted

    We really do need a separate KB article to articulate this more clearly.  This information is in the whitepaper, but obviously not clear enough. 

    You need to turn the "notification-based" caching off on IIS to get this to work.  You need to do this for the Static file cache and for the ASP file cache.  For asp.net (and other application content) turn caching off altogether. 

    To turn off this "notification-based" caching for IIS (in other words, use a polling method to check the last-modified timestamp instead):

    <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>

    • Static Pages

    Set the registry property, DoDirMonitoringForUNC, a DWORD value located at HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Inetinfo\Parameters, to False or 0.

     <o:p></o:p>

    • ASP Scripts

    Set the registry property, EnableChangeNotificationForUNC, a DWORD value, located at HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\ASP\Parameters to False or 0.

     

    By the way, this is the default behavior (AFAIK), so if you were to remove the registry keys that you have set you'd be in a lot better shape. 

     

    The key you might want to twiddle with is the latency on the last-modified time check (default of 5 seconds).  The doc says:

     

    For some sites, a five-second window will be too large a window, and for others, too small. The sampling interval is configurable with the following registry keys, which are not present by default:

    Static pages Set the registry property, FileAttributeCheckThreshold, a DWORD value, located at HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Inetinfo\Parameters.  If the DoDirMonitoringForUnc registry property, a DWORD value located at HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Inetinfo\Parameters, is set to False, IIS checks the cache entries for change after a period of time equal to the value set for the FileAttributeCheckThreshold registry property. Effective with Windows Server 2003 SP1, IIS checks both the worker process file cache entries and the HTTP.sys cache entries.

    ASP Scripts Set the registry property, FileMonitoringTimeoutSeconds, a DWORD value, located at HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\ASP\Parameters.

    Using the last-modified cache update mechanism will result in more reliable and secure delivery of content. Additionally, it will scale well on a wide application structure (where your Web server has lots of applications pointing at thousands of different directories). There is, however, a performance penalty that may be noticeable in regards to static content. 

    Hope that helps!

     

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, July 16, 2008 1:36 PM
  • User10285400 posted

    BTW, thanks Steve for letting me know about this question.

    Wednesday, July 16, 2008 1:37 PM
  • User1073881637 posted

    Thanks for posting a in-depth answer.  I'll be curious to hear from the poster to see if this helped.  I'll definitely be bookmarking this post.  Any chances of getting a whitepaper or blog posting on this topic?

    Wednesday, July 16, 2008 5:24 PM
  • User10285400 posted

    Yep, I'm working with some folks to get a blog and eventually a KB article published.  I'll respond to this post when it's done. 

    Wednesday, July 16, 2008 5:40 PM
  • User-67419931 posted

    UPDATE:  After enabling content expiration for http headers through IIS I was not even able to access the documents.  The function partially worked as I hoped.  After the expiration time was reached, IIS didn't deliver the expired content.  However, it never looked for a fresh copy to serve.

     I disabled the feature and also restored the registry to the original configuration with no IIS tweaks.

     

    I proceeded to add the following to the reistry:

    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Inetinfo\Parameters

    -DWORD DoDirMonitoringForUNC (0)
    -DWORD FileAttributeCheckThreshold (0)

    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\ASP\Parameters

    -DWORD EnableChangeNotificationForUNC (0) 
    -DWORD FileMonitoringTimeoutSeconds (1)

    I restarted IIS and still experienced the issue after testing for about 5 minutes.  I tested this morning and haven't been able to replicate the issue.  The changes should've taken place right after the IIS reload so it doesn't look like this resolved the issue.  I will test updating the documents today and give a status update.

     

    Thanks again.

    Thursday, July 17, 2008 10:05 AM
  • User-67419931 posted

    UPDATE:

     I have been testing throughout the day and have not had any cahing problems after applying the latest registry changes.  I'll continue testing since the problem has been so sporatic and intermittent.  I'm skeptical since this didn't work last night immediately after applying the reg changes and restarting IIS - unless the changes need to propegate somewhere else besides IIS.

    Thursday, July 17, 2008 2:36 PM
  • User1073881637 posted

    For a situation like this, I would tear down your environment (or build another one) to truly understand which registry entries made the difference. .  Going forward, you know and can explain it.  Understanding something unique like this (it's not a common thing using Novell's CIFS server as a content server in IIS althought there is nothing wrong with it either),  The better you understand the environment, the easier is should be to support.  I think it's cool you are using the two environments together, you get the best of both worlds.  I appreciate you publishing your updates, this helps others and is interesting.

    On a side node, if I wanted to test this on my own, would using a linux box with SAMBA represent something similar?

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Friday, July 18, 2008 6:37 AM
  • User-67419931 posted

    I'm certain I wouldv'e experienced the caching issue by now. So the last changes I made resolved the problem.

     Steve,

    I agree that tearing down the environment is a good idea.  But in terms of time, I don't think that is an option.  Any time I tried new registry changes, I removed the testing entries and also ran a .reg backup that was made before I began initial testing.  I have another envionrment besides Prod where I will test just the changes below before implementing these changes in real-time.  I will keep you guys update.

     I can confidently say that the registry changes I applied below to disable change-notification caching and tweak the last-modified settings worked.

     

    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Inetinfo\Parameters

    -DWORD DoDirMonitoringForUNC (0)
    -DWORD FileAttributeCheckThreshold (1)

    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\ASP\Parameters

    -DWORD EnableChangeNotificationForUNC (0)
    -DWORD FileMonitoringTimeoutSeconds (1)

    I haven't used the SAMBA protocol, but from what I understand it's file sharing ability is based on that of CIFS.  Since the caching mechanisms are defined within IIS, this should work for any remote file server that is accessed through IIS via UNC path.

    Thanks all.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Friday, July 18, 2008 11:09 AM
  • User1073881637 posted

    Excellent! I'm glad you are confident you found the answer.  That is a good idea to keep the registry entries like you did.  I'll be curious to hear how your production install goes.

    Friday, July 18, 2008 9:05 PM
  • User-67419931 posted

    I made these changes to another test environment.  So far so good.

    Tuesday, July 22, 2008 1:56 PM
  • Tuesday, August 5, 2008 5:33 PM