Boosting NFS speed

Hi all,

I’ve had issues accessing video content on a server. With help of this forum I got a fstab mounted samba working. However with some bigger files it wasn’t enough so I went with NFS. It is better but not perfect, I still have stuttering image and caching with some files. So can someone tell me if my fstab entry could be better:

192.168.1.41:/export/Torrents /mnt/Nusb nfs noauto,x-systemd.automount,soft,tcp 0 0

Info: Rpi3, OSMC, accessing via WIFI

Thank you,

Here is the topic of the first issue that was nearly resolved using samba and fstab entry:
Caching, freezes and sound stuttering on movies over Smb & NFS - #13 by ActionA
Still with some issues at rebooting discussed on topic : "a stop job is running" for samba unmount - #16 by sam_nazarko

There we go, there’s the problem

Well that’s not the question. My setup relies on wifi access so I m asking for any tip to get the most out of it !

I’ve been told the same when no files at all were playing, than someone suggested to go fstab rather than accessing the share via kodi. And it worked great! Nearly everything is smooth now. By the way on the same wifi on my mac computer and on a tablet: everything work like a charm, the movies are perfectly watchable. I’ve tried with another Wifi dongle, same issue.

So my question is : is there any tweaks to my NFS setup I could implement. Starting from my fstab entry:
192.168.1.41:/export/Torrents /mnt/Nusb nfs noauto,x-systemd.automount,soft,tcp 0 0

Hi @th0m I’m not sure I can offer any advice that hasn’t been offered before but I’m very interested in any solutions you may find as I have the same issue.

1 Like

Sorry for being blunt but if you want to stream HD over WiFi you’re highly likely to run into trouble!

Fancy posting a media info of any file you’re having issues with so we can see the bit rate?

Other than that the differences between SMB shares and NFS shares will be so miniscule (in my experience) it’s not likely worth any effort and you’re best investing in either home plugs or finding a solution based on Ethernet, even wireless AC would be a major improvement. What I’m saying is I very much doubt changing a few protocol tweaks will get you the results you desire.

Good luck

I am not even talking about high bitrates.
For example here’s one of the mediainfo: http://paste.osmc.io/xecutotiqu.vhdl
Actually, I think minor tweaks is what I need. It was horrible at first and now I m nearly there. It s generally smooth with some slowdowns or caching from times to times. While at first I had no sound and it was lagging so much that I couldn’t even watch 10 sec without stopping.

I have both samba and nfs shares entries set up, I just need to uncomment one to try it. So I am open to any suggestion or tests. I went NFS because I read it was generally faster on rasp pi.

If you can’t run an ethernet cable to simply test if the issue is resolved without the wifi, then you should look into running iperf tests to see what your maximum achievable throughput in your situation is.

Ok so I did it and here’s the result:

osmc@osmc:~$ iperf -c 192.168.1.41 -r

Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)


Client connecting to 192.168.1.41, TCP port 5001
TCP window size: 43.8 KByte (default)

[ 5] local 192.168.1.9 port 55174 connected with 192.168.1.41 port 5001
[ ID] Interval Transfer Bandwidth
[ 5] 0.0-10.0 sec 37.4 MBytes 31.2 Mbits/sec
[ 4] local 192.168.1.9 port 5001 connected with 192.168.1.41 port 40696
[ 4] 0.0-11.1 sec 11.0 MBytes 8.29 Mbits/sec

Hello all,
That’s the line I’m adding into the /etc/fstab file, I’ve made some research a couple of time ago. I don’t know if that’s the best config ever. I always wanted to make some speed test but it actually work fine for me now so I never took the time.

192.168.0.4:/volume1/multimedia/ /home/osmc/multimedia nfs4 nolock,rsize=16384,wsize=16384,intr,timeo=800,x-systemd.automount 0 0

Let us know
Flo

Good work!

There was a long debate on the Raspbmc forums with @DBMandrake performing investigations in to the best ‘wsize’ value. That was seemingly the best variable to tweak to improve performance.

@sam_nazarko @flori4n Thanks I will run some tests using wsize.

So basically I’ve tried rsize and wsize at 16384. Doesn’t seem to change much. I’ve changed between soft and intr,timeo with no real difference. I’ve even tried to switch in my modem to channel 13 on my wifi (authorised here) but OSMC or the integrated chipset doesn’t even see the wifi. The other channels are packed with people…

TL;DR : Still no perfect solution. Should I try another value than 16384 for wsize and rsize or just some crazy magic tweak solution not tried yet ?

Thanks everyone anyways for the help!

Hi th0m,

I am using the following settings on my RPi 2:

192.168.1.11:/mnt/movies /mnt/osmc-movies/ nfs x-systemd.automount,_netdev,nfsvers=3,ro,intr,noatime,rsize=32768,wsize=32768,nolock,async,proto=udp 0 0

In your line, you force the protocol to run over TCP, what is potentially a bit slower than using UDP (proto=udp). In @flori4n’s line protocol is omitted, but if I recall it, it defaults to UDP. My buffers are a bit bigger, but that may not have as much difference as the UDP protocol choice (at some point buffer sizes are not improving too much, maybe 16k/32k are already in that range). Also, @flori4n’s line is asking for nfs v4, what my server is not supporting (or maybe at that time RPi was not supporting), but could be potentially a plus to have. Since I don’t care for write access on the RPi side, my line also have ‘ro’ (read only). I am not sure whether ‘async’ may help or not. So using settings from @flori4n and my lines should get you close to the best NFS settings. If that doesn’t fix all your problems, you will need to also start looking into your WiFi setup.

As far as WiFi, if you don’t live in an apartment, and don’t have much interference, then WiFi channel selection may not do anything for you. If you do, instead of guessing a channel number, you would need to use some app to see which channels are less busy (less routers are using them). (Netgear has a nice Android app for that.) However, if you could get to a 5GHz range, your speed may be better (usually less crowded, but in a single home may not have the reach). However, if I recall it right, RPi USB implementation may not be giving you the full USB2 speed, so switching from 2.4 to 5GHz may not really improve it that much.

With all that said, my setup is over the Ethernet cable, and if I recall it, it gives me ~10-12mbps max speed what potentially is max what you get over the Ethernet on RPi 2. As you can see, that is well below 100mbps Ethernet speed, and well below any decent WiFi router.

Best,
Jacek

1 Like

@jacek Thanks so much for that very complete answer, I will give it a try.

I do live in an apartment and I use a Wifi analyser app to find the best channel (which would be 13 but its not seen by the pi3) . However my wifi gives me a 8Mbps according to iperf. This should read most of the file I am trying to. I guess tweaking NFS could help me. I will definetly try a new line with your comments in mind!

Thanks !

@th0m You welcome. Happy that can help a little. Although, I made a big mistake above. The speed that I am getting is ~12MBps (mega bytes), so actually close to the max what 100Tx Ethernet can give (so further tweaking will not improve much anymore). You can run the following command:

dd if=/mnt/movies/test.file of=/dev/null
9841113+1 records in
9841113+1 records out
5038650339 bytes (5.0 GB) copied, 421.202 s, 12.0 MB/s

This way, you can point to one of your videos (test.file in this case), and see how fast it goes over the protocol you are using at the moment. This test should give you about the same results as Kodi should see. Of course, just moving that file takes a bit of CPU time.

Best,
Jacek

Just so you know, you’ll only get reliable streaming over Ethernet. You can try all you like but you’ll not get it working especially in a block of apartments

I’d love to be more positive but you’ll not succeed without upgrading to faster wireless or using Ethernet.

You may achieve momentary success but as soon as the bitrate increases you’ll run into issues again.

However when you do achieve success let us know.

I do totally agree with you. It is clearly the main issue. However, I rent the place I cannot run Ethernet cable through any walls… I still find the challenge interesting. The higher the bitrate I can have over Wifi the happier I’ll be. I do not seek perfection at all. However, when I test with iperf between the server and the pi3 , I clearly get a network speed that sould be enough for the files I am trying to watch. So there seems to be room for improvement for either samba or nfs shares and I’ll keep trying, researching the internet, and testing any advice that might be given on this topic.

To keep updated: UDP seems really not to like Wifi , I switched back to TCP. Wsize 16k or 32k doesn’t seem to make any difference.
And most surprisingly, after a few days of using both, it seems that Samba gives a more reliable, more stable stream.

Take a look:

Be wary of the marketing, the advertised speed is the “data rate” between the devices including all error correction and compression algorithms so throughput is roughly 10% (from experience.

Getting a 500Mbps set should do you go for HD. But the faster the better.

Unfortunately, I agree with martin_l. If you live in a block of apartments, you’re going to be suffering from lots of interference from your neighbours’ networks.

At home, I have my Internet connection through my office, and my living room (with pretty much all media devices in the TV stand connected to Internet) is connected to the office (where my server is located) through Homeplugs/PowerLAN and a switch. I still suffer from interferences on this, mind you, so I only get 112Mbps tops between the rooms when conditions are ideal, but it often falls below 50Mbps if lots of electric/electronic devices are stitched on (it’s a very old block of flats, so the electric installation is much older than I am). That should still be more than enough for most cases, but I do get break-ups and buffering with very high bitrate HD files (I think I start to get issues from about 3GB per hour (e.g. I’ll get some buffering if a 2h video file is bigger than 6GB) - That’s my rule of thumb in my particular case, anyway).

As far as PowerLAN goes, I’d recommend to use passthrough adapters (i.e. the PowerLAN adapter has a male power outlet, so that you can connect something else on top of it), because they filter the immediate interference generated by the electrical devices behind it:

Note that my setup is a bad example because I still use the power outlet right beside my PowerLAN adapter… But I believe this is still much better than using a regular adapter on a multiplug, as seen on the picture in Martin’s post.

From what I’ve read about PowerLAN vs WiFi in the past, it could very well make a huge difference for you.