Accessing CIFS shares from an OS X machine incredibly slow

This is a longshot, because this issue seems over-reported and unanswered on the internet (see references below), but it is about time this issue is permanently solved.

The facts:

  • Server: Windows Server 2008, acting as a file server
  • Client: OS X Lion 10.7.3.
  • Method of connecting: directly via IP through Finder: smb://192.168.1.100/share

The problem:

  • The initial connection attempt takes about a minute.
  • After the connection is made, it takes one more minute to show the directories in Finder.
  • After navigating to any other directory, it takes several seconds/minutes to parse the directory, seemingly based on the size of the contents.
  • Actually, my entire Finder has this problem after connecting. When using Finder to show my desktop, it can literally take up to a minute to load.

Obviously, this is not right. I have no clue how to fix this and would appreciate any help I can get. I am unsure about other relevant information I can provide, but if there is any, please let me know so I can update the post.

I seem to be not the only one having this problem:

  • Most importantly, an apple.stackexchange.com entry. Unsolved and unanswered.
  • Several users on the Apple support forums.
  • Users on EduGeek.

Solution 1:

I would not be surprised if this is an incompatibility problem related to the newer SMB2 protocol which debuted in Windows Vista (and the original Windows Server 2008). If you can get your hands on a Windows 2000/XP machine and test the Mac's performance when accessing a share on the 2000/XP host, you'll find out if it's an SMB2-related problem, since XP and below didn't have SMB2 and the introduction of the SMB2 protocol is notorious for having caused similar problems, specifically related to "fast queries." If an XP or below system doesn't exhibit the same file sharing issues with your Mac, and you have admin rights on the server or can talk to someone who does, a .reg file which will turn off the fast queries behavior on the server (and any Vista or above system, remember that WS2008 is effectively "Windows Vista server edition") is as follows:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]
"LmCompatibilityLevel"=dword:00000002

Also see the tips on this page for additional suggestions that are specific to this problem with Snow Leopard (and probably newer OS X versions also): http://www.macwindows.com/snowleopard-filesharing.html#030311b

One other possibility is that the network's DNS server is returning the wrong IP address for the name of the server, or that you are using an incorrect DNS server when on this network. If this is a domain, the Windows Server should be used as the primary DNS server. If the DNS server settings in use go to the ISP's DNS servers or a router, and the ISP DNS has standards-noncompliant "typo correction" or "search suggestions" features on by default which redirects non-existent domain names to an ISP search page rather than returning the (correct) NXDOMAIN response, attempts to reach the server by its name will misbehave a lot. Try using the IP address of the server instead of its NetBIOS name to see if a misconfigured or misbehaving DNS situation is causing the problem. For more information about the ISP DNS issue, see: https://en.wikipedia.org/wiki/DNS_hijacking#Manipulation_by_ISPs

Solution 2:

Setting these two registry keys helped me drastically improve windows share performance for Macs on Windows Server 2012 and Windows 8.1

win_share_tweak.reg

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters]
"Smb2CreditsMin"=dword:00000300
"Smb2CreditsMax"=dword:00004000

From the MSDN description:

Smb2CreditsMin and Smb2CreditsMax HKLM\System\CurrentControlSet\Services\LanmanServer\Parameters \ (REG_DWORD)

The defaults are 64 and 1024, respectively. These parameters allow the server to throttle client operation concurrency dynamically within the specified boundaries. Some clients might achieve higher throughput with higher concurrency limits. One example is file copy over high-bandwidth, high-latency links.

Altering the values from the default 64/1024 to 768/16384 helps the OS X considerably.