How to Fix Slow Access to Network Shares

[responsivevoice_button voice="US English Male" buttontext="Listen to Post"]

Last year I wrote this article "What to Do When Creating Folders or Accessing Files on Remote Computer is Very Slow." In that article I mentioned several troubleshooting techniques and tips on fixing the issue of slow network access to shares. In this article, I will share another method to address the issue. After I had fixed the issue last year. I started to have the same problem again. This time I used the following registry modification to fix the issue. The problem was related to the SMB2 cache redirection as explained by Microsoft in the article SMB2 Client Redirector Caches Explained.

PROBLEM

Access to network files and folders is very slow. The network drives are mapped in Windows 10, Windows 8, or Windows 7.

SOLUTION

Here's the step-by-step procedure on how I was able to resolve the issue. I was using Windows 10 Pro on the computer that was having the issue and that's where the following change should be made to the registry. The network shares were also on a Windows 10 Pro desktop, but the registry change needs to be made on the computer which is experiencing slow access, not the one that's hosting the network shares.
WARNING! This solution requires modifying the registry. Modifying the registry is like doing a brain surgery on the computer. Only trained individuals who know what they are doing should modify the registry. The information in this article is for reference only. Modify the registry at your own risk.
  1. In Windows Search box type regedit and press Enter to access the Registry Editor.
  2. Go to HKEY_LOCAL_MACHINE and locate System\CurrentControlSet\Services\Lanmanworkstation\Parameters.
  3. Create a new DWORD value for DirectoryCacheLifetime.
  4. Double-click the value and set it to zero (0).
  5. It's not necessary to disable additional caches, but if the above setting doesn't fix the problem, then you may want to disable two additional SMB cache values. One for FileInfoCacheLifetime and another for FileNotFoundCacheLifetime. You need to add both of them as type REG_DWORD and set the value zero (0) to disable them, if they don't already exist in the registry.
NOTE: Whether to use DWORD or QWORD has nothing to do with the type of Windows 10 operating system (32-bit vs. 64-bit) you are using. For more information visit this article: Using DWORD vs. QWORD When Adding Values to Windows Registry.
WARNING! It's possible that you may experience a significant performance hit by disabling these caches. If that's the case, simply re-enable these caches by deleting these registry keys. Deleting them will set it back to their default values, or you can manually change the values to their default settings. The default values are supposed to work for most scenarios, but that's not always the case.
Here's the description provided by Microsoft for each of these cache values. FileInfoCacheLifetime: File attribute information which is contained in the File_Network_Open_Information structure which is useful in conserving network IO for retrieving common file metadata information. To disable or turn off the caching behavior the value of this registry key should be changed to 0. Turning off the file information cache is not recommended as it could nearly double the number of network transactions required for executing a given scenario. Default is 10 seconds. FileNotFoundCacheLifetime: This is a cache of files which the client failed to open because the file was not present on the server. This prevents the client from repeatedly attempting to open files which are known not to exist on the server. This cache is likely to affect distributed applications running on multiple computers accessing a set of files on a server – where the applications use an out of band mechanism to signal each other about addition/deletion of files on the server. Default is 5 seconds. DirectoryCacheLifetime: This is a cache of recent directory enumerations performed by the client. Subsequent enumeration requests made by client applications as well as metadata queries for files in the directory can be satisfied from the cache. The client also uses the directory cache to determine the presence or absence of a file in the directory and uses that information to prevent clients from repeatedly attempting to open files which are known not to exist on the server. This cache is likely to affect distributed applications running on multiple computers accessing a set of files on a server – where the applications use an out of band mechanism to signal each other about modification/addition/deletion of files on the server. Default is 10 seconds. Last Updated: March 18, 2020
Thanks for reading my article. If you are interested in IT training & consulting services, please reach out to me. Visit ZubairAlexander.com for information on my professional background.

Copyright © 2018 SeattlePro Enterprises, LLC. All rights reserved.