Samba share, write performance

samba

I'm running a debian jessie server which provides a samba-share on an external drive using ext4, its read and write speed is about 80MB/s and 40 MB/s. The client which I'm currently using is Win7. Both machines are connected to a Gigabit-LAN which provides transfer rates of about 80-90 MB/s.

Reading from the samba-share works as expected with transfer rates of 60-70MB/s. However, when writing to that share on the Win7-Client, the performance is about 1MB/s.

Has anybody experience such a bad write performance in a similar scenario? Are the any tweaks for the given setup to optimize the performance? Or would it help to change the filesystem etc.?

Best Answer

There are a few options for SAMBA to improve read/write performance. For your case may be an important option is write cache size. Here is a quotation from https://www.samba.org/samba/docs/man/manpages-3/smb.conf.5.html.

write cache size (S)
If this integer parameter is set to non-zero value, Samba will create an in-memory cache for each oplocked file (it does not do this for non-oplocked files). All writes that the client does not request to be flushed directly to disk will be stored in this cache if possible. The cache is flushed onto disk when a write comes in whose offset would not fit into the cache or when the file is closed by the client. Reads for the file are also served from this cache if the data is stored within it. This cache allows Samba to batch client writes into a more efficient write size for RAID disks (i.e. writes may be tuned to be the RAID stripe size) and can improve performance on systems where the disk subsystem is a bottleneck but there is free memory for userspace programs. The integer parameter specifies the size of this cache (per oplocked file) in bytes.

Default: write cache size = 0
Example: write cache size = 262144 # for a 256k cache size per file

You may find working example here: http://www.arm-blog.com/samba-finetuning-for-better-transfer-speeds/ and https://coderwall.com/p/2ufa0g/fix-samba-read-and-write-performance-issues

You need to adjust those options in [global] Section of /etc/samba/smb.conf file and need to restart samba. You may check the samba man page mentioned above for clarification of the options.