Linux – Removing and copying files slow on NFS folder

linuxnfsUbuntu

I have a server that hosts images and allows access to one directory for one client over NFS.
The directory contains about 70K images and is 12GB big.

When I execute commands like cp or rm on the server that hosts the NFS directory performance is stellar, but when execute the cp or rm from the client on the NFS directory commands sometimes get really slow where the real time is slow and user and sys times are fast:

real    1m33.409s
user    0m0.000s
sys     0m0.000s

My assumptions are:

  1. The directory gets somehow locked thus causing the long wait
  2. The connection between the two servers is somehow not reliable

Here's a dump from the client's nfsstat -c

Client rpc stats:
calls      retrans    authrefrsh
3018431    1          3018571

Best Answer

You should try the noatime option when mounting the remote filesystem in the client.

From man 8 mount

noatime  -  Do not update inode access times on this 
filesystem (e.g., for faster access on the news  spool
to speed up news servers).

In my case, it improved write performance a lot.