Speeding up SMB/CIFS Connections
From Provider Wiki
In some cases connections from a Macintosh computer to a Windows file server can be very slow. Counter intuitively this is particularly true when the client is on a faster connection.
Contents |
The Symptoms
File transfer can be very slow, with a few hundred megabytes taking hours to transfer. Listing a directory can also be slow at times, but that is not always the case.
This problem can be confused with another problem where speeds are fast in one direction, but slow (even to the point of timing or erring out) in the other direction. If that describes your problem then you probably have a port-duplex mismatch between your client and switch or your server and switch.
The Problem
The issue is that in many cases the way Microsoft has chosen to implement SMB deliberately breaks TCP/IP for those connections. Specifically they are not properly working with TCP "ACK" packets. These packets are supposed to allow fast connections to properly gauge how quickly they can transmit information without loosing too much data on the wire. So when the server does not respond properly to these packets the client computer keeps lowering the speed at which it sends things. This is a broken implementation on the Windows side, but luckily there is a solution on the Mac side.
The Solution
The solution is to tell SaMBa (the open-source package that handles this sort of connection on MacOS X) to work in the same broken way as the Windows server in this regard. To do so you need to add this line to your "/etc/smb.conf" file
socket options = TCP_NODELAY IPTOS_LOWDELAY
This should be added in the "[global]" section, and should have a line of its own.
I don't know if it requires you to reboot the client computer, or will work for new connections, but it is probably practical to reboot the computer.
The Solution Walk-through
For this walk-through you need to be an admin on the computer you are working on.
- Open up Terminal.app
- type in "sudo pico /etc/smb.conf" - this will ask you for you password so that you can get the rights to work on this file
- use the arrow keys to scroll down in the file to the bottom of the "[global]" section
- at the end of the section put in a few returns for spaces and enter these two lines:
; added by <your user name> on <the current date> socket options = TCP_NODELAY IPTOS_LOWDELAY
Note that there is a ";" in front of the first line making it a comment
- then hit <control>-x to close out of the file
- hit "y" when it asks you if you want to save and then return again to use the file name it suggests
I don't know if it requires you to reboot the client computer, or will work for new connections, but it is probably practical to reboot the computer.
