[Samba] Performance optimizations for small files and case sensitive-option

Jeremy Allison jra at samba.org
Wed Jan 10 00:37:59 UTC 2018


On Tue, Jan 09, 2018 at 01:44:22PM +0100, Rainer Krienke via samba wrote:
> Hello,
> 
> I am running a samba server on a SLES12SP3 machine smb version
> 4.6.9+git.59.c2cff9cea4c. The samba server offers only the smb service,
> the file data are stored on separate NFS servers because files are
> accesses by our users from either linux or windows systems. So a write
> to this samba server always will read or write files from/to NFS servers.
> 
> The problem is speed when many very small files are copied from windows.
> I have a test directory of 70MB in size consisting of 5528 mostly very
> small (<=70Kb) files. The directory is stored on a local disk on the
> windows machine. "Copy via smb" below means, I copy the data from a
> Windows 10 VM to a share connected on the smb server (which results in
> writing the data on the NFS file servers). The time it takes to copy
> this directory is as follows:
> 
> Copy testdir 70MB with 5500 single files via smb:   300 sec (5min)
> Copy zip archive of testdir (1 file, 46MB) via smb:  ~2 sec
> Copy this directory on smb server via NFS, cp -ar:   90 sec
> Copy test dir via smb to local fs on smb server:     90 sec
> 
> I tried a lot to make the copy process of many small files faster and
> finally came across the case sensitive option of samba:
> 
> Copy testdir 70MB with 5500 single files via smb:    180 sec (3min)
> using "case sensitive= yes"
> 
> This is about 1/3 faster compared to the 300sec without the case
> sensitive option. Unfortunately case sensitive files and windows leads
> to strange effects that many users will not understand and thus is not a
> real option for productive use (think of creating a file hellO.txt and
> another hello.txt and a user deleting the only one he sees in explorer).
> 
> So I thought if for copying one file samba has to check if this file
> already exists in all sorts of upper/lower spellings which takes a lot
> of time with NFS it might help to use bigger caches. So I set
> smb max stat cache size and directory name cache size to a higher value
> (see config below). But unfortunately it did not help (~300sec).

You must canonicalize the filenames on the NFS server. Make them
all upper case, then:

See this (old) page for details:

https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/largefile.html

case sensitive = True
default case = upper
preserve case = no
short preserve case = no



More information about the samba mailing list