Guide: 20+ MB/s read and write speed via Samba NTFS!

This forum is for Marvell Kirkwood devices such as the GoFlex Home/Net, PogoPlug v1/v2, SheevaPlug, and ZyXEL devices.

Guide: 20+ MB/s read and write speed via Samba NTFS!

Postby Obihoernchen » Wed Feb 06, 2013 5:38 am

Hi guys,

A complete guide is available at my blog: obihoernchen.net

first of all I want to hear your opinion about the following before I post a full guide in the guide section.
I got my PogoplugV2 some days ago and installed alarm. The default software is such a piece of ***** o.0

I have to use NTFS because I have several 2,5" HDDs and I want to share content via USB with other friends too ;)
So I installed everything set up samba and the performance sucks. Yes I expected that.

Samba
Read ~16MB/s
Write ~5MB/s <-- sloooooow

Benched with dd, hdparm and values were
Read ~29MB/s <-- nearly USB 2.0 limit
Write ~6MB/s <-- ultra slow again...

Write speed is very important for me so I tried several things to speed this up.
First of all I had to improve the NTFS performance. And there is a really simple mount option which will increase write speed dramatically - big_writes :)
$this->bbcode_second_pass_quote('', 'T')his option prevents fuse from splitting write buffers into 4K chunks, enabling big write buffers to be transferred from the application in a single step (up to some system limit, generally 128K bytes).


1) Mount your HDD with noatime and big_writes
I wrote a small guide how to do this with udevil (automount): http://obihoernchen.net (6.)

Now I'm able to reach:
dd, hdparm bench
Read ~29MB/s
Write ~28MB/s <-- great! So the NTFS bottleneck should be "fixed". I know other FS would produce less CPU usage but a lot of people want to or have to use NTFS...

Samba performance is better as well:
Read ~16MB/s
Write ~11MB/s <-- more than 2x

That's pretty good already but there is even more potential.
Let's tune /etc/samba/smb.conf
There are several options which will increase speed slightly like:
$this->bbcode_second_pass_code('', 'socket options = IPTOS_LOWDELAY TCP_NODELAY SO_KEEPALIVE')
But 2 options will boost your speed really much:
write cache size
$this->bbcode_second_pass_quote('', 'I')f 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

And use sendfile
$this->bbcode_second_pass_quote('', 'I')f this parameter is yes, and the sendfile() system call is supported by the underlying operating system, then some SMB read calls (mainly ReadAndX and ReadRaw) will use the more efficient sendfile system call for files that are exclusively oplocked. This may make more efficient use of the system CPU's and cause Samba to be faster. Samba automatically turns this off for clients that use protocol levels lower than NT LM 0.12 and when it detects a client is Windows 9x (using sendfile from Linux will cause these clients to fail).

Default: use sendfile = false


2) Edit /etc/samba/smb.conf and add the following lines to [global]
$this->bbcode_second_pass_code('', 'socket options = IPTOS_LOWDELAY TCP_NODELAY SO_KEEPALIVE
write cache size = 2097152 # 2MB - you should test some values it's pretty memory intesive
use sendfile = yes')
I didn't test the write cache size that much. Maybe 128KB would be enough (See big_writes)

Final Samba result with 2,5" HDD with 1TB NTFS Partition @ PogoplugV2 with 3.7.6 Kernel @ Gigabit LAN:
Read ~22MB/s :mrgreen:
Write ~20MB/s :mrgreen:
Last edited by Obihoernchen on Tue Mar 12, 2013 7:54 am, edited 1 time in total.
Visit my Blog for Pogoplug guides
Obihoernchen
 
Posts: 17
Joined: Thu Jan 31, 2013 3:17 am
Location: Germany
Top

Re: Guide: 20+ MB/s read and write speed via Samba NTFS!

Postby moonman » Wed Feb 06, 2013 7:08 am

I've read that about samba before as well. :) Good find, doesn't seem like there's any downside to those options, aside from memory usage.

About big_writes: "The big_writes options is generally useful when copying big files, but not recommended when updating them." I suppose the files are then updated in big chunks which is inefficient. But it's definitely worth a shot.
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3387
Joined: Sat Jan 15, 2011 3:36 am

Re: Guide: 20+ MB/s read and write speed via Samba NTFS!

Postby Socaltom » Wed Feb 06, 2013 2:24 pm

$this->bbcode_second_pass_quote('moonman', '
')About big_writes: "The big_writes options is generally useful when copying big files, but not recommended when updating them." I suppose the files are then updated in big chunks which is inefficient. But it's definitely worth a shot.


If you are using the device as a fileserver this makes a sense. You don't update files, you download the whole file, then send it back. I would keep an eye on fragmentation, the speed will probably drop signficantly if the fragmentation creeps up.
Tom
used to be owned by me
Pink Pogo V2, Black Pogo V3, Zyxel NAS 325 v1,
used to be Adminstrator for
Goflex net, Black V3, Black V2
Now I have a couple of raspberry pi ( 3+ and 4)
Socaltom
 
Posts: 571
Joined: Thu Apr 07, 2011 2:21 pm
Location: The left side
Top

Re: Guide: 20+ MB/s read and write speed via Samba NTFS!

Postby moonman » Wed Feb 06, 2013 6:49 pm

$this->bbcode_second_pass_quote('Socaltom', '
')You don't update files, you download the whole file, then send it back. I would keep an eye on fragmentation, the speed will probably drop signficantly if the fragmentation creeps up.
Tom


That is the case with FTP, but samba actually implements random access.
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3387
Joined: Sat Jan 15, 2011 3:36 am
Top

Re: Guide: 20+ MB/s read and write speed via Samba NTFS!

Postby Obihoernchen » Wed Feb 06, 2013 7:20 pm

I'll check fragmentation frequently and report.

RIght now it's 2% after using the HDD for about 1/2 year. 80% Full. Allocation size = 64KB.
Mainly for HD movies and some backups.

Anybody knows even more parameters I could try?
Visit my Blog for Pogoplug guides
Obihoernchen
 
Posts: 17
Joined: Thu Jan 31, 2013 3:17 am
Location: Germany

Re: Guide: 20+ MB/s read and write speed via Samba NTFS!

Postby moonman » Wed Feb 06, 2013 8:40 pm

You can play with samba buffers in socket options:

SO_RCVBUF= and SO_SNDBUF=

mine are set to 131072 (128kB), some people find it performs better with 65535 (64kB)

also "read raw" and "write raw" =true/false. See which one performs better for you. According to samba wiki by default those are true
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3387
Joined: Sat Jan 15, 2011 3:36 am

Re: Guide: 20+ MB/s read and write speed via Samba NTFS!

Postby Obihoernchen » Wed Feb 06, 2013 11:33 pm

Thanks!
yes I've tried all these settings already :)

Couldn't meassure any difference for SO_RCVBUF and SO_SNDBUF.
Same for read and write raw :/
Visit my Blog for Pogoplug guides
Obihoernchen
 
Posts: 17
Joined: Thu Jan 31, 2013 3:17 am
Location: Germany

Re: Guide: 20+ MB/s read and write speed via Samba NTFS!

Postby matjaz » Sun Feb 24, 2013 1:23 am

Is there any way to add noatime and big_writes to udev-automount?
matjaz
 
Posts: 37
Joined: Thu Jan 05, 2012 11:00 pm

Re: Guide: 20+ MB/s read and write speed via Samba NTFS!

Postby moonman » Mon Feb 25, 2013 7:55 pm

There's is, i think it's under /etc/udev/rules, can't remember exactly since it doesn't work with systemd and ntfs drives anymore so i haven't used it for a while.
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3387
Joined: Sat Jan 15, 2011 3:36 am

Re: Guide: 20+ MB/s read and write speed via Samba NTFS!

Postby jeajea » Fri Mar 08, 2013 8:50 pm

Thanks for figuring this out. On a Dockstar which ony has 128MB Ram I am get 20+ MB/s read and 18+ MB/s writes with large (greater than 4GB) files. :) :)
Jim Anderson
3 Dockstars, 3 Pogoplug V2 and a Zyxel NSA325
Treasure Island, Fl
jeajea
 
Posts: 121
Joined: Wed Aug 25, 2010 4:00 pm

Next

Return to Marvell Kirkwood

Who is online

Users browsing this forum: No registered users and 7 guests