[Samba] Unusually long time to retrieve directory listing when it contains many files

Stephan Stachurski ses1984 at gmail.com
Fri Jun 4 07:34:04 MDT 2010

I am trying to replace a windows file server with a linux samba server to
serve files on our local network only. There are a few important folders,
which many users will be accessing many times a day, that include thousands
of files. The biggest directory contains 15,000 files. (I'm trying to
re-organize the workflow so that such long directories aren't needed, but
for now things have to stay this way).

When navigating to these directories in gnome, windows, or the linux command
line over smbfs, it can take as long as 15 or 20 seconds to load the
directory. This seems strange for two reasons: if I ssh into the samba
server and ls -l one of these directories, the results are returned very
quickly which leads me to believe the problem is not in the file system, and
because performance is worse by orders of magnitude than using the old
windows server. The hardware on the old windows server is worse in every
way: slower CPU and disks, less RAM, and a worse NIC.

Is it possible to tune the performance so that it becomes comparable to the
windows server? I have added TCP_NODELAY and IPTOS_LOWDELAY which doesn't
seem to have an appreciable effect (I didn't bench it, but it's still on the
order of 15-20 seconds, not on the order of 1 second like the old server). I
have also tried different values of SO_SNDBUF and SO_RCVBUF.

My samba server is running smbd 3.4.0.

Stephan E Stachurski
ses1984 at gmail.com

More information about the samba mailing list