Samba performance is slow with an OSX 10.6 client

mac-osxsamba

I have just set up a new Samba 3.3 server on a virtualized CentOS 5.4 machine and have found that it is having performance issues under a very particular set of circumstances. My boss has a Macbook Pro running Mac OSX 10.6. When he tries to…say…transfer a 30 megabyte file onto the server, it is excruciatingly slow (15+ seconds).

Here is a couple of other interesting data points, though:

  • Transferring the same file off the server only takes a few seconds. The extreme slowness is only on write.
  • Transferring the same file onto an old samba server that we've already got set up running Fedora Core 5 and Samba 3.0 is almost instantaneous. Needless to say, we're trying to upgrade, or else we would continue to use it.
  • Transferring the same file onto the new server using SFTP takes 1-2 seconds.
  • When I try to transfer the same sample file onto the new server using my personal OSX 10.5 machine, it takes around 5-6 seconds no matter what protocol I use (Samba, SCP, SFTP). So it's slower than my bosses machine on the other protocols, but faster when using Samba.

I have already tried some of the speedup tricks listed in Google such as socket options = TCP_NODELAY, read raw and write raw, but none of them appear to have any effect on the resulting speeds. The firewalls are all configured correctly, with the virtual host passing along all bridged traffic to the appropriate virtual server and "Samba" is allowed through on the virtual server itself. I also looked through the old server's configuration file and nothing jumped out at me as being a "aha, this is why it's so fast."

Any other ideas?

EDIT: New information. I found out that my computer was using WiFi instead of ethernet. When I switched to ethernet, my performance on the server became identical to my bosses in every aspect (SFTP fast, Samba write super-slow, etc.).

Best Answer

Is it possible the ethernet switch you're connecting to is mis-negotiating to a half-duplex connection with the Macs? Your description (high speed one direction, low the other, gets worse if you try to send data really fast) sounds like what I've seen when one end (the switch in your case) is in half-duplex mode and the other (the Mac) is trying to use full-duplex mode.

You can check the mode on the Mac with the ifconfig command (look for a line that says something like "media: autoselect (1000baseT ) status: active"; how you check (/whether you can check) on the switch depends on its management interface (if any). You might also be able to diagnose this using something like netstat -p tcp -s -- if this is the problem, you'll probably see lots of retransmits.

Note: if the server and Macs are on different switches, it's also possible there's a problem with the connection between switches.