Alexander's Blog

Sharing knowledge with the global IT community since November 1, 2004

How to Fix Slow Access to Network Shares

/
/
img

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).
    DirectoryCacheLifetime
  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.

  • Facebook
  • Twitter
  • Linkedin

41 Comments

  1. I’m just hoping to clarify…
    I noticed that in the screenshot you add the registry key to: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Lanmanworkstation

    but in the instructions you say to add it:
    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Lanmanworkstation\Parameters

  2. Nice catch, Jimmy. The instructions are correct, the screenshot is incorrect. I fixed the error and have updated the screenshot accordingly. I appreciate you pointing out the error.

  3. I was a couple of weeks with this problem, disabled updates, reinstalled drivers, changed network settings. thanks for the contribution, I leave a line for CMD…

    Reg add hklm\System\CurrentControlSet\Services\Lanmanworkstation\Parameters /v DirectoryCacheLifetime /t REG_DWORD /d 0

  4. Hi there, I have the same issue but we run on a farm/server based environment. I appreciate your help in advance.

  5. Hi Guys,

    I think I am hitting the same wall here. Windows 10 Machine based in UK, the network share is based in NY data centre just few thousand miles away. When user opens an Excel or pdf file its taking ages to open the file on local machine. Please help.

  6. Thanks! After an hour and a half of pulling out my hair found your post. Worked great just by the first step. Cheers from Canada!

  7. Hi. I am confused a bit

    Where do you do make this registry change?

    A. Is it on the machine that does NOT have the share?
    B. Is it on the machine that has the share?

    Thanks.

  8. Thanks for this! I haven’t tested for slow network connections, but I have a strong feeling that it’ll fix another problem I sometimes run into, where one client sometimes just can’t see a new or changed file in a shared folder even though everyone else does, no matter how much one refreshes.

  9. @Nyer sorry about the confusion. I am updating the article to make it clear where the change is required. If you are on Computer A and the access to shared network files on Computer B is very slow, then you will make the change in the registry on Computer A where you are experiencing the problem.

  10. The DWORD value for DirectoryCacheLifetime is already set to zero (0) and I am still having the same issue (slow access to files on the network share drives). Is there anything else that can help to resolve this? Your advise is greatly appreciated.

  11. Hi Zubair,

    I think I found a solution to my problem. In addition to setting the DWORD of DirectoryCacheLifetime to zero (0), the other two parameters below will have to also set to zero (0).

    FileInfoCacheLifetime Dword=0 ====> my problem is here…missing this parameter.
    FileNotFoundCacheLifetime Dword=0

    Hope this helps others who are having the same problem.

  12. Hi Hank, I guess you read the first four steps, but not step 5 in which I mentioned that if the first registry change doesn’t help then you may want to disable two additional SMB cache values that I have listed.

    Glad to hear that it fixed your problem. I appreciate you providing the feedback.

  13. Your undo advice is incorrect.

    Setting the values to 1 does not undo or re-enable the caches with their default values. It re-enables the caches with 1 second timeouts.

    The proper advice to undo the change is to delete the registry key(s) OR set these timeouts explicitly:
    DirectoryCacheLifetime = 10
    FileNotFoundCacheLifetime = 5
    FileInfoCacheLifetime = 10

    Source: https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-7/ff686200(v=ws.10)

  14. @Computer Guy: You are correct. To re-enable the caches you need to delete the registry keys, which will set them back to the default values, or manually set them to their default values. I have updated the article. Thanks for your feedback.

  15. I have been searching for a solution of the slow transfer speed problem on the internet, all I found were suggestions on buying new network hardware or set wifi from 2.4G to 5G.
    Thank you so much, your first tip solved the week-long problem that I experienced since the last win10 update. Cheers from China.

  16. Microsoft doesn’t specifically say that the change requires a reboot in its article, but because registry changes often require a reboot, its best to restart the computer.

  17. Here Is The Solution to Windows 10 Super slow file transfers, after Many Years, from 2013 to now (19 January 2020):
    1. Yes, do all those things that you have read about here and elsewhere. They will have some effect, but not much and it may be a temporary effect in speed increase. But they ARE worth doing.
    2. To actually achieve a permanent solution with speeds close to Window 7, the DELETE both Microsoft Windows Defender and also McAfee Antivirus, etc. programs. If you are using McAfee as your “Paid-For” antivirus, etc. software, then just delete the MS Defender. Read up on that…some reboots will be required before it is all gone.
    3. To delete McAfee, you download from McAfee main website and use their mass deletion program, named “MCPR.exe”.
    4. I use Norton 360, so it is the only Antivirus program in operation once I boot up. By deleting the other two, the computer only checks the files going in and out using one program, not three, and they fight it out which slows the file transfers even more. In fact, they stop if you more than two transfers at the same time. That is how anyone can Prove that even Windows 10 is not a genuine multi-threading operational system, unlike LINUX.
    5. This does work and is permanent. Be sure to delete the MCPR.exe sub-directory once you are finished.. You can search for the program name “MCPR.exe” on the C: Drive, it is usually hiding out in there. Good luck and Good Re-Booting twenty times…what can I say….”Microsoft so-called programming”. Regards, Ian.

  18. Hey,

    We ran into the opposite 🙂
    I admin about 70 machines – but with Win10 January 2019 Update (Jet 4.0. issues) we ran into issues with our Acess Database backend. Randomly the backend is destroyed twice a day from different machines.
    After we applied Directory Cache = 0, FileCache = 0 and FileNotFound = 0 the issue is gone – but….the system is so slow now you hardly can work.

    Does anybody have a clue for this? 🙂
    Best regards from here to you
    Sascha

  19. @Sascha: As I stated in my warning, you may experience a significant performance hit by disabling these caches. Did you try to just disable DirectoryCacheLifetime first and see what happens. According to Microsoft, turning off the FileInfoCacheLifetime is not recommended because it can nearly double the number of network transactions required.

    Perhaps you should consider experimenting with the values for these caches. Instead of turning them off completely, try to use a number between 0 and the maximum number suggested by Microsoft. For example, try using a number between 1-10 for FileInfoCacheLifetime and DirectoryCacheLifetime, and between 1-5 for the FileNotFoundCacheLifetime. I have never tried a variation of these values but it may be worth experimenting. If that doesn’t work, you may have to contact Microsoft tech support.

  20. I followed the updated instructions carefully. After rebooting… I could no longer access the shared drives on the file server that is on the local network. The newly created DWORD:
    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Lanmanworkstation\Parameters\DirectoryCacheLifetime was set to 0.

    I then deleted the DWORD entirely, rebooted again, and I still don’t see the network drives.

    Any assistance would be greatly appreciated.

  21. UPDATE… I RE-created the DWORD, but this time set the value to 10 (hex). Now, at least, I can see the shared folder on the file server. Speed is still terrible however…. two MB/s on a network that is all gigabit-ethernet.

  22. @Joeseph: If you haven’t already, you may want to make sure that you’ve read step #5 and the warning right after step #5. I mention in step #5 that if step #4 doesn’t work for you then you may need to disable FileInfoCacheLifetime and FileNotFoundCacheLifetime cache values.

  23. Alexander, thank you for the info, it’s helpful, somewhat. With the advent of the 64bit Windows 10 would a person change the DWORD to a QWORD if they were having slow response from network shares?
    I have a Win10 and a Mac High Sierra system that share files. From the Mac to Windows it reasonably fast – no complaint. But from Windows to Mac it takes approx. 10 – 12 seconds to display the directory structure. Would you consider this normal?

    I’m using a Netgear Nighthawk router connected to a giga-bit switch, DHCP. Everything is wired, no wireless.

  24. @Terry: Whether to use DWORD or QWORD has nothing to do with your Windows 10 version (32-bit vs. 64-bit). When you store data under a registry, you have to specify certain values and the type of data that is being stored. For example, the REG_DWORD value can store a type of data that’s a 32-bit number and REG_QWORD value can store a type of data that’s a 64-bit number. These numbers do not correspond to the Windows 10 operating systems.

    You would rarely see instructions to add QWORD entries. I have updated the article and added a note about DWORD/QWORD. Basically, if the instructions say to use DWORD then you use DWORD, if the instructions say to use QWORD then you use QWORD.

    In my opinion, 10-12 seconds is not normal to display the directory structure. You have to troubleshoot both the hardware and software to find the culprit.

  25. Alexander, this morning I re-read your post – my apologies for the Q-WORD/D-WORD question, you addressed in your post. So, after adding the additional entries (all three because the first one had no effect) to my Registry and setting the defaults you mentioned, the browsing to my two other computers (Mac High Sierra and Windows 10 Pro) is very quick – like it was when I first transitioned to Windows 10. The computers under Network in the File Manager populate immediately now as do the sub-folders.
    Thank you for your expertise.

  26. Zubair, After writing the post from earlier today I went back to work using my Mac for desktop publishing. It has been agonizingly slow – click on something, anything, and get the colored spinning wheel. It could be to launch an application, locate a file, select a font, it didn’t matter.
    As I went back to work I immediately noticed that there was no more delays/pauses. Everything was snappy quick. I wondered if the slowness on the PC was somehow increasing network traffic and therefore causing some service on the Mac to have to “answer” that service.
    You’re my new Windows 10 hero.
    Thanks, again.

  27. You don’t need to edit the registry to adjust these. They can be set from an admin PowerShell window:
    set-SmbClientConfiguration -DirectoryCacheLifetime 0

    # view all settings
    get-SmbClientConfiguration

  28. This is just a GENIUS post. I have been going out of my mind trying to figure out WHY accessing files on my NAS has suddenly gotten so slow. I made the change to the registry and I’m back to flying top speed. Thank you ever so much for writing this (and my PC thanks you, because it was moments away from being tossed out the 16th floor window).

  29. @Shay: Thanks for your feedback. Glad to know that I was able to not only help you but I also saved a perfectly fine PC from getting tossed out of the 16th floor window :).

  30. I just used this suggestion for a Windows 10 System with a ReadyNAS 316, and it works great now! Thank you!

  31. OMG…This is AMAZING…I didn’t even have to reboot. I have struggled with the slow access to shares for a while. The difference is night and day. Thank you so much for this post and help!

  32. Thank you Zubair!! The single regedit entry (steps 1 – 4) fixed it for me. I noticed the problem after upgrading from Win10 1909 to 20H2 (I had problems with the upgrade itself, which disappeared once I uninstalled my antivirus, and reapplied 20H2. I don’t know if the problematic upgrade was a contributing factor to the issue here). In any event, I appreciate the help, and more importantly, that you took the effort to update/correct the article as needed! It boggles the mind that this is still a ‘default’ problem across multiple major versions of an OS. I suppose there’s a reason for not having the entry included. Would you happen to know why?

  33. @Paul: What I have documented is only a workaround for a problem that’s been around for a while. The DirectoryCacheLifetime entry is not included in the registry by default because Microsoft doesn’t want you to disable the cache. Cache is supposed to help you, but sometimes it does the exact opposite and slows things down.

  34. Thank you for this…! I used all the suggested values noted (the first didn’t fix alone) which immediately resolved the delays I was having connecting to my Synology file servers from File Explorer that I’ve been contending with for years.

  35. If anyone is still having this problem, then in my case, the problem PC was windows 1803 version. I tried all of the above steps but problem did not go away. After upgrading windows to 20H2 (the latest) the problem disappeared.

Leave a Comment

Your email address will not be published. Required fields are marked *

This div height required for enabling the sticky sidebar