Ubuntu – Poor samba performance between Win Vista workstation and Ubuntu 9.04 file server

performancesambaUbuntu

Ok, linux dudes, please bear with me. I'm a windows dude who just set up his first linux server…

The problem I am having is that samba performance is really poor both when reading and writing from/to a samba share residing on the linux box. Local disk i/o on the box itself is great, the machine is idle and I am the only one accessing it. I have googled and tried some of the common workarounds mentioned when people run into samba performance issues but so far it has had no effect whatsoever.

Server config:
Intel ATOM 330 D945GCLF2 w bios 229 (latest)
2x WD1001FALS (WD caviar black 1Tb), set up with linux software raid during installation
2gb DDR2 (800 5-4-4-18 downclocked to 500-3-3-3-9, passed all memory tests by memtest86)
Ubuntu 9.04 server amd64 + samba and subversion
Wired 100 mbps network connection from onboard NIC to a Linksys WRT300N

Client config:
Dell inspiron 9400, Windows Vista x64, 4Gb RAM, no performance problems otherwise.
Wireless g connection (54Mbps, I get ~25Mbps against other resources on the same network)

Local disk I/O on the linux box has great throughput:

$ sudo hdparm -tT /dev/md2

/dev/md2:
 Timing cached reads:   1310 MB in  2.00 seconds = 655.21 MB/sec
 Timing buffered disk reads:  294 MB in  3.01 seconds =  97.82 MB/sec
$ sudo hdparm -tT /dev/sda

/dev/sda:
 Timing cached reads:   1324 MB in  2.00 seconds = 661.47 MB/sec
 Timing buffered disk reads:  318 MB in  3.00 seconds = 105.85 MB/sec
$ sudo hdparm -tT /dev/sdb

/dev/sdb:
 Timing cached reads:   1328 MB in  2.00 seconds = 663.55 MB/sec
 Timing buffered disk reads:  300 MB in  3.01 seconds =  99.55 MB/sec

However, when I copy files over the network to the samba share, I get write speeds around 1-1.5Mb/s. When reading files from the samba share it takes a long break (several seconds) before reading the files.

Now, TCPStat on the server shows a lot of traffic from the windows box just by opening the samba share as a unc share in explorer in windows. It looks like windows is enumerating files, but I wouldn't expect that to block anything else..? Or is samba by default all-sequential single-session/single-connection?

Any ideas? When googling I came across some articles for older linux versions where they recommended recompiling and replacing the realtek driver, but none of those articles mentioned ubuntu 9.04. And I don't really feel comfortable with starting to recompile the OS and/or device drivers before having pinpointed the root cause of the problem…

Edit: here's my smb.conf file (with comments etc removed) ->

[global]
   workgroup = WORKGROUP
   wins support = yes
   dns proxy = no
   name resolve order = wins lmhosts host bcast
   log file = /var/log/samba/log.%m
   max log size = 1000
   syslog = 0
   panic action = /usr/share/samba/panic-action %d
   encrypt passwords = true
   passdb backend = tdbsam
   obey pam restrictions = yes
   unix password sync = yes
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
   pam password change = yes
   map to guest = bad user

      SO_RCVBUF=8192 SO_SNDBUF=8192
socket options = TCP_NODELAY

   usershare allow guests = yes

[printers]
   comment = All Printers
   browseable = no
   path = /var/spool/samba
   printable = yes
   guest ok = no
   read only = yes
   create mask = 0700

[print$]
   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   guest ok = no

[someshare]
comment = images
read only=no
locking = no
path = /home/someusername/someshare
guest ok = no

Best Answer

It sounds like your network card is only going at 10Mb/s. But before you fool around with the card, first try connecting your laptop wired to rule out a wireless issue. If you have the same problem, try copying something using scp instead of samba. Just download pscp from link text and transfer a file by typing:

pscp <your file> <linux user>@<linux server>:<folder> 
for example:
  pscp c:\temp\some-big-file.txt KristoferA@192.168.0.2:/home/KristoferA 

If that runs slow too then your problem isn't Samba, you likely just need a different network card driver.