Samba Optimization findings

Guides written by the community, for the community, and only guides!

Samba Optimization findings

Postby Socaltom » Wed Jul 01, 2015 4:34 am

Im using a Zyxel NAS 325 running arch with the 4.0 kernel. I noticed that file transfers have been in the 30MB/s range and I know from history that these drives are capable of much more so I decided to do some optimization of samba. Some of my findings were counter to some others, so I thought I would post what worked for me.

For starters, my network is 1 gigabit, and my win 7 PC demonstrated a file transfer to another win 7 PC of over 70MB/s accross the network. So I'm satisfied that the network hardware is up to faster speeds. The win 7 PC has an SSD drive to provide one side of the test system. I used robocopy /TEE to establish the speed of the transfers. I created a directory with 227 jpgs of 500K to 1M and a 4.6GB movie for test purposes. The transfer took about 2 1/2 minutes.

Its important to note that I'm running ext4 drives through Samba. The drive format and other network parameters impact if these options work.

So, the usual options mentioned in the optimization posts are the socket options.
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=393216 SO_SNDBUF=393216

I tried multiple sizes for the buffers, from 8192 to 512K
Lowest speed 12.2 MB/s was at 8192, fastest speed 37.9MB/s was at 393216 (384K)
at 512K the speed dropped down to below 37.

Once I set the buffer size I tested several of the other options

sendfile . with send file true I got 36.5MB/s with sendfile=false I got 38MB/s
read raw
write raw
The default is =raw, and that worked better for me.
one setting that made about a 2MB/s increase was
strict allocate = yes , on an ext4 drive this takes advantage of extents and speeds things along. on a badly fragmented ext3 the system stalled and wouldn't even start the transfer. Under normal settings when the file is transferred the sender requests space for the file, and samba normally lies to the sender and says it reserved the space, but it only reserves it as packets arrive, since this would normally be faster for most systems. With ext4, and extents large chunks can be easily reserved, so its faster to do it up front and then not worry about it..

Ultimately I ended up at about 37 MB/s. According to some online reviews of the Zyxel system with the normal firmware it should be capable of 60ish MB/s transfer rates so I'm still a little disappointed.
Tom
Owned by me
Pink Pogo V2, Black Pogo V3, Zyxel NAS 325 v1,
Adminstrator for
Goflex net, Black V3, Black V2
Socaltom
 
Posts: 567
Joined: Thu Apr 07, 2011 2:21 pm
Location: The left side

Re: Samba Optimization findings

Postby moonman » Wed Jul 01, 2015 5:10 am

There was a guide on optimizing other aspects of the system. I average at about 40MB/s on my GF-Home which is 1/3 slower.
Pogoplug V4 | GoFlex Home | Raspberry Pi B 512 | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | |[armv5] How to install my.pogoplug.com service | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3089
Joined: Sat Jan 15, 2011 3:36 am
Location: Calgary, Canada

Re: Samba Optimization findings

Postby WarheadsSE » Wed Jul 01, 2015 12:31 pm

capable of

Sadly, this also means either what they maxed out on, or even more likely the theoretical limit.

I do know that the stock firmware attempts to us XFS as much as it can. I can't speak to anything about that though.
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6727
Joined: Mon Oct 18, 2010 2:12 pm

Re: Samba Optimization findings

Postby Socaltom » Thu Jul 02, 2015 12:56 am

WarheadsSE wrote:
capable of

Sadly, this also means either what they maxed out on, or even more likely the theoretical limit.

I do know that the stock firmware attempts to us XFS as much as it can. I can't speak to anything about that though.

Here is a link to the review. It seems legit
http://www.smallnetbuilder.com/nas/nas- ... l=&start=2

FWIW these are the parameters I found on the default system ( which does break the 40MB/s barrier).

Code: Select all
   
  kernel oplocks = no
        socket options = IPTOS_LOWDELAY TCP_NODELAY SO_SNDBUF=131072 SO_RCVBUF=131072
        use mmap = yes
        max xmit = 131072
        min receivefile size = 128k
        unix extensions = no
        wide links = Yes
        oplocks = yes
        level2 oplocks = no
        max smbd processes = 128
        printing = cups
        printcap = /etc/printcap
        load printers = yes
        use sendfile = yes
Owned by me
Pink Pogo V2, Black Pogo V3, Zyxel NAS 325 v1,
Adminstrator for
Goflex net, Black V3, Black V2
Socaltom
 
Posts: 567
Joined: Thu Apr 07, 2011 2:21 pm
Location: The left side

Re: Samba Optimization findings

Postby Socaltom » Sat Jul 04, 2015 3:03 pm

I reverted back to the Zyxel FW. With that setup and all the same hardware my transfer speed for a read is up around 80MB/s and my write is about 65MB/s. I hooked up a usb3 4 bay enclosure, and I get 30 to 40MB/s when transferring to/from the drives there to my win7 box. So it appears there is plenty of room to improve these transfer speeds.
Tom
Owned by me
Pink Pogo V2, Black Pogo V3, Zyxel NAS 325 v1,
Adminstrator for
Goflex net, Black V3, Black V2
Socaltom
 
Posts: 567
Joined: Thu Apr 07, 2011 2:21 pm
Location: The left side


Return to Community Guides

Who is online

Users browsing this forum: No registered users and 1 guest