Latency Problems with NFS
I'm trying to set use multiple Linodes in a structure with, a load balancer, multiple webservers, a file server and a DB server.
The problem here is that webservers connect to the file server through NFS, but it turns the application very slow, making a website take more than 7 seconds to open, when it usually opens in less than 2 seconds.
Here's a test using
/home is mounted from file server):
[[email protected] ~]# time dd if=/dev/zero of=/home/testfile bs=16k count=262144 262144+0 records in 262144+0 records out 4294967296 bytes (4.3 GB) copied, 485.917 s, 8.8 MB/s real 8m6.276s user 0m0.464s sys 0m7.159s
[[email protected] home]# time dd if=/dev/zero of=/home/testfile2 bs=16k count=262144 262144+0 records in 262144+0 records out 4294967296 bytes (4.3 GB) copied, 4.71624 s, 911 MB/s real 0m4.719s user 0m0.119s sys 0m3.398s
It's not viable to keep the files within the webservers, because of the constant maintenance of these files.
Is there any suggestion on how can I reduce the latency, or any other way to make a connection with a fileserver?
This looks like the latency is caused by the cpu not the network. I would verify this using the ping command between your Linodes. If you are using a NFS I would make sure that all of the Linodes are in the same data center and using private IPS.
We can provide private IPs by reaching out to Linode Support and they are free. Then I would test the latency using the ping command to verify again.
If you have multiple Linodes accessing the NFS Server, I would increase the size of that Linode. I would resize your Linode using the Resizing a Linode Guide.
Don't forget when resizing your Linode to also resize the hard disk using the Resize a Linode Disk Guide.