sabato 6 giugno 2015

NFS over OpenVPN over ADSL(or slow connection), best settings

In recent years I have often used NFS shares through OpenVPN, with a 7Mbit ADSL connection, and I have always faced a great slowness in directory listing (takes a lot of seconds to do ls or update the file manager view) and file transfers.
For the sake of completeness, I'm using Linux Mint 17.. it's a Debian like distro.

I have read lot of posts and I have tried the reasonable subset of suggested solutions, I'm going to provide a configuration walkthru; this is the summary of the best tips:
  • use a NFS packet size smaller than littler MTU size (default is 8Kbytes, new values should be littler than 1500bytes, few guys suggest 1024bytes)
  • use NFS TCP connection type; do not use UDP on ADSL/WANs
  • use the NFS async option
  • do not set very small timeouts, left the default 60 secs (timeo=600) or.. I have tried with success 10secs (timeo=100) too
  • with the hard mount option, let's add the intr option

For linux users,  here is a little fstab configuration example for soft mounts:

servername:/shared/     /mnt/foldername/  nfs     rw,suid,dev,soft,exec,nouser,async,noauto,timeo=100,user,rsize=1024,wsize=1024,tcp 0 0

and here, for hard mounts:
rw,suid,dev,intr,exec,nouser,async,noauto,timeo=100,user,rsize=1024,wsize=1024,tcp 0 0

I have also used rsize/wsize = 1350.
These findings have been obtained with the typical mambo-jambo, fire&forget, try&see experimental procedure.
  • Yes, I have read the manuals (they suck)
  • yes, I have chosen only the reasonable subset of internet tips
  • yes, I have tried  lots of permutations 
I am far from a statistically significant sample :-).
These changes have improved my NFS usability, doubling the download speed for a single file and raising a lot the browsing responsiveness.
NFS over vpn+adsl is still dramatically slow (at the moment I am transferring files at about 150 KB/sec, and this is far better than without the proposed changes).
Please consider that my 7Mbit ADSL has a download bandwidth of 800KB/sec.

I hope that these tips are going to work in your case too..

Have you find out a better solution? Other magical NFS options? Please share, tips are welcome.
Have fun

2 commenti:

  1. Good work, this was exactly what I needed to fix my Casper Netboot over OpenVPN site-to-site tunnel.
    I used kernel parameter: