Fixing a slow Samba server on Ubuntu 12.04

I recently upgraded my Ubuntu from 11.10 to 12.04. Mostly worked fine, the usual little config mishaps. But then one really bad problem: my SMB server on the Ubuntu box was terribly slow with my Mac client. Like reading a file would get 100kbytes/second. This on a gigabit ethernet where I used to be able to do SMB at the disk speed of 30Mbytes/second.

I ruled out some basic stuff: local disk access was fine, and copying the file via nc was super fast so it wasn’t the network. I started at guessing things. The final fix was to remove this line I’d previously put in my smb.conf

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

Not sure why those settings would be harmful, nor which specific setting is the problem. The smb.conf man page suggests TCP_NODELAY is the default so I’m guessing it’s the buffers. Anyway, SMB is fast again.