4

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.?

  • Have you tried a different client to see if the write speed is any quicker? We experienced this in 3 different servers and different OS, RHEL, CentOS and SLES. The first one was the network card was faulty, second one got fixed with a reboot of the server. 3rd one we just gave up. – lbanz Nov 09 '15 at 17:20
  • More info on the hardware setup might also be useful. E.g. what sort of interface are you using for your external hard drive? If it's USB, that would most likely be your bottleneck. Be aware of caching potentially obscuring what's going on here if you get your testing methodology wrong. – mc0e Nov 10 '15 at 11:42
  • What are your sync settings in smb.conf? See https://lists.samba.org/archive/samba/2008-September/143609.html – Andrew Henle Nov 10 '15 at 12:00
  • Run vmstat and see if the disk write IO's are maxing out at 120-200, in which case you need to increase block size and/or cache size, as bangal suggests.

    Im gessing your external drive is USB - they die in the ass if the read or write pattern is not sequential.

    – Patrick Nov 13 '15 at 02:43
  • Also, you state 40mb for writes to this drive - presuming that is a sequential write thorughput becnhamark, it is not a very good result at all – Patrick Nov 13 '15 at 02:45
  • @user236012, It would have been great if you could take your time to update us about the posted answers and whether it helps solve your problem or not. In case you have found a solution yourself, you can post it as an answer too. This way people visiting this question will get a better understanding of the issue and probably a solution too. – Diamond Nov 18 '15 at 14:26

3 Answers3

1

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.

Diamond
  • 9,131
0

I had the same issue basically. After lots of research and tinkering with the Samba config, I managed to make it transfer at a reasonable speed by adding IPTOS_THROUGHPUT to the socket options config parameter and removing IPTOS_LOWDELAY.

0

How fast can the Debian server write to the external drive? (use fio or something to test this)
What kind of latency do you get to the external drive? (perhaps test with dd or something)
Whats the latency from the Win7 client to the share? (simple ping will do)
Can you provide your /etc/samba/smb.conf file?

There are a lot of factors that play into the maximum theoretical read/write speeds to a share. There are also several configuration options that can effect the speeds as well. If you can provide some further details perhaps myself or another user can help you locate the problem or improve those write speeds.

B. Miller
  • 707