How to performance test and select best samba and network share settings


#1

Hi

Ive compiled and tried CoreELEC, I like it.

Next, I wanted to mount a samba share by the systemd and kernels cifsd and not use kodis userspace libsmbclient, for performance and ease of maintenance.

So, you can ssh root@yourcoreelec and leave a file in /storage/.config/system.d/storage-datas.mount and mkdir /storage/datas and systemctl daemon-reload && systemctl start storage-datas.mount

Now, you can do dd if=someBigFile from the mounted storage of=/dev/null and check how fast seqential reads happen.

This is my results:
options vers=3.0, no rsize,wise: 25Mb/s (rsize wsize is not even applied at vers 3)
options vers=1.0, rsize,wsize at 8mb, 109Mb/s
options vers=2.0, rsize,wsize at 8mb, 50mb/s

So you can see, using vers 1 on odroid c2 CoreElec from latest mast, reaches almost staggering 1gbit/s sequential read. Also, adding Options=blah,cache=none leads to 10mb/s !

The other benefit of using samba/cifs over NFS, is the server can run smbd as a user for increased security, while no good nfs userspace servers exist.

These tests were performed with the following sysctl network options, non both server and odroid c2 client.
Put these lines in a file in /storage/.config/sysctl.d/01-net.conf
and systemctl
net.core.netdev_max_backlog = 262144
net.core.rmem_max = 16777216
net.core.rmem_default = 31457280
net.core.wmem_max = 16777216
net.core.wmem_default = 31457280

Increase the read-buffer space allocatable

net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.udp_rmem_min = 16384

Increase the write-buffer space allocatable

net.ipv4.tcp_wmem = 4096 87380 16777216
net.ipv4.udp_wmem_min = 16384

meh “let the kernel scale it based on RAM”

#net.ipv4.tcp_mem = 65536 131072 262144
#net.ipv4.udp_mem = 65536 131072 262144

Increase the maximum amount of option memory buffers

net.core.optmem_max = 25165824
net.ipv4.tcp_fin_timeout = 3

Increase the tcp-time-wait buckets pool size to prevent simple DOS attacks

net.ipv4.tcp_max_tw_buckets = 1440000
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
net.ipv4.tcp_rfc1337 = 1
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_keepalive_probes = 5
net.ipv4.tcp_keepalive_intvl = 15
net.nf_conntrack_max = 1048576
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv4.tcp_mtu_probing = 1