Slow NFS

Hello,
I have some issues with HD playback. With mkv files the playback is slow and freezing 30s for 2s of playing.

My setup :
raspberry pi B+
OSMC up to date
No addons
fresh install
NAS (openmediavault)
NFS share
Mysql library share

I was suspected my network, so I run some tests.
With bonnie++ and mounted file system.
I tested with NFS and SMB share to compare.


It’s clear to me that NFS as a poor latency (16x smb latency).
Beside switching protocol, which i’m going to do, where this difference came from ?

Thanks for your help

I forget to add a sample of avconv info :
Stream #0.0(fre): Audio: ac3, 48000 Hz, 5.1, s16, 640 kb/s (default) Metadata: title : VFQ AC3 @640Kbps BPS : 640000 BPS-eng : 640000 DURATION : 02:16:57.216000000 DURATION-eng : 02:16:57.216000000 NUMBER_OF_FRAMES: 256788 NUMBER_OF_FRAMES-eng: 256788 NUMBER_OF_BYTES : 657377280 NUMBER_OF_BYTES-eng: 657377280 _STATISTICS_WRITING_APP: mkvmerge v8.8.0 ('Wind at my back') 64bit _STATISTICS_WRITING_APP-eng: mkvmerge v8.8.0 ('Wind at my back') 64bit _STATISTICS_WRITING_DATE_UTC: 2016-03-13 22:43:17 _STATISTICS_WRITING_DATE_UTC-eng: 2016-03-13 22:43:17 _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES Stream #0.1: Video: h264 (High), yuv420p, 1280x534, PAR 1:1 DAR 640:267, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default) Metadata: BPS : 5214805 BPS-eng : 5214805 DURATION : 02:04:37.512000000 DURATION-eng : 02:04:37.512000000 NUMBER_OF_FRAMES: 179280 NUMBER_OF_FRAMES-eng: 179280 NUMBER_OF_BYTES : 4874220954 NUMBER_OF_BYTES-eng: 4874220954 _STATISTICS_WRITING_APP: mkvmerge v8.8.0 ('Wind at my back') 64bit _STATISTICS_WRITING_APP-eng: mkvmerge v8.8.0 ('Wind at my back') 64bit _STATISTICS_WRITING_DATE_UTC: 2016-03-13 22:43:17 _STATISTICS_WRITING_DATE_UTC-eng: 2016-03-13 22:43:17 _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES

I assume if you are testing NFS via Bonnie you must be using a Kernel mount in /etc/fstab, not Kodi’s built in NFS client ?

If so, post your fstab so we can see your mount options for NFS and SMB. (Hide any passwords of course)

Kodi use it’s own nfs.
But for test purpose, i used kernel nfs/smb :
Kodi conf:
NFS
moorea:/export/Films on /mnt/Films type nfs (rw,nosuid,nodev,noexec,relatime,vers=3,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.0.253,mountvers=3,mountport=41862,mountproto=udp,local_lock=none,addr=192.168.0.253,user)

SMB
//moorea/Films on /mnt/smb-films type cifs (rw,nosuid,nodev,noexec,relatime,vers=1.0,cache=strict,username=root,domain=MOOREA,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.0.253,unix,posixpaths,serverino,mapposix,acl,rsize=1048576,wsize=65536,actimeo=1,user)

server conf :
NFS
/export/Films 192.168.0.0/24(rw,all_squash,insecure,no_subtree_check)

SMB
[Films] path = /media/ad38d53b-3b41-4020-be00-7aa25617bad7/Films/ guest ok = yes guest only = yes read only = no browseable = yes inherit acls = yes inherit permissions = yes ea support = no store dos attributes = no printable = no create mask = 0755 force create mode = 0644 directory mask = 0755 force directory mode = 0755 hide dot files = yes

The Raspberry Pi 1 struggles with NFS over TCP, if you want to get the best performance on a Pi 1 I would actually use UDP.

Your rsize and wsize are also rather large, I would drop them to 8192 for UDP.

I would simplify your NFS line a lot, you have a lot of unnecessary stuff, try something similar to this:

moorea:/export/Films /mnt/Films type nfs vers=3,rsize=8192,wsize=8192,udp,retrans=2

NFS should be performing better than SMB, not much worse.

Thanks for your answer, I will try that today.
FYI : It’s not my fstab entry, but the resulat of mount -v to display all options in use :slight_smile:

By the way, if the new test are correct, how to convert such conf to kodi. Because the target is kodi nuilt-in nfs mount.

Ah, it would have been helpful to see the lines directly from fstab, not the output of mount -v…

If you want to stream high bitrate videos on a Pi 1 I would not recommend using Kodi’s built in NFS client, it has a number of shortcomings and will never perform as well as a kernel nfs mount. You’ll get at most about 25Mbps while playing video.

Here they are:
192.168.0.253:/export/Films /mnt/Films nfs user 0 0 //moorea/Films /mnt/smb-films cifs rw,user 0 0

Ok so I will test with kernel mount.
But If I remenber correctly, the share path is in mysql data, so all my shared library will be obsolete ?

Ok try the mount line I suggested.

Cross that bridge if you get to it - lets see if the kernel mounts with the right options can improve the performance. As a test you can play some videos via Video->Files, browsing directly to the mount points in /mnt.

If necessary you can use path substitution to remap the paths so you don’t need to rescan the library, if you don’t fancy rescanning the whole library.

Test are not so conclusive for bonnie:

But the playback seems better.
I will try with other files to confirm

Might be unrelated but it has just occurred that this may help, can you give it a try ?

I will try the conf,
But I do’nt have managed switch, only GBE standard swicth and GBE internet box.

For the library, I came to an other solution, drop database, replace nfs by local mount point and reinsert database.
It’s a small update to do, and don’t required full library rescan :slight_smile:

Any way thanks, i will try this setup for a little time to ensure not issues appear .

Sorry I mean just try the turbo option. For the user in that thread it helped him even on a switch with flow control enabled. (not sure why though)

After some test, the playback is find :slight_smile:
I need to run other tests to check NFS speed on another system.
I will try bonnie on my archlinux to see if there is any difference.

I’ll keep you posted

If smsc95xx.turbo_mode=Y improves network playback, can you test with that option removed and smsc95xx.packetsize=4096 added instead?

We know turbo_mode causes issues in some heavy use cases (e.g. torrent downloading), so we’d like to find a safer alternative that still provides the network performance improvement.

You need to be on the April update for this option to be supported.