If you are running Vista or Mac OS X 10.5 / Leopard, you might have noticed that accessing files on Samba shares over your corporate network is dreadfully slow. Note that I’m not talking about network as in “my 10mbit Ethernet at home”, but as in “those strange fiber optic thingies running to my computer” (even though the problem occurs on slower networks as well).
But why is Samba such a pain suddenly?
The short version: because Vista and Leopard have a different behind-the-scenes network config than XP and Tiger.
The long version: when you receive a file over a network, the file is chopped in packets, which are sent to your system one after the other. Whenever you have received a packet, you will send a notice of receipt to the server (“ok, I got packet XYZ, and it is intact”). Obviously, sending all these acknowledgments creates quite some traffic. That’s why Vista and Leopard use bulk acks: you don’t send an ack for every packet, but you wait until you have received (let’s say) 10 packets and send one ack for all of them.
And that “you wait until” is the tricky part. Because Samba is a synchronous protocol, the server won’t send the next packet until it has received the ack for the last.
Get the picture? There’s a timeout, of course - your system won’t wait for eternity until it sends an ack for the < 10 packets it had received. The timeout should be ~100ms on your system. But 1/10 of a second between each small packet sums up to a hell of a time.
And that’s why Samba can be really slow.
Now, the obvious solution to this problem is to use a shorter delayed ack. BUT DON’T PLAY WITH YOUR SYSTEM IF YOU DON’T KNOW EXACTLY WHAT YOU ARE DOING!
If you are running Windows, try this: set a delayed ack value in your registry.
You are happily working on Mac OS X? Then enter this command:
sudo sysctl -w net.inet.tcp.delayed_ack=0