NFS file attribution caching causes reading inconsistency in multi-producer scenario
With two producers e.g. local and remote producers, the changes made locally might need time to be acknowledged by the remote.
Even without file caching this could still be a problem, I experience this first-hand while using Python. I think Python might use some kind of file attribute to determine file updates. NFS has this which is called “attribute caching”.
If you mount NFS with the option actimeo
, it enables this attribute caching mechanism. To disable it consider using noac
option.
There is a mention about performance degradation of noac
option. The source suggests that actimeo=0
has lower performance impact comparing to noac
.
Personally, I see noac
and actimeo=0
to be too much a drag on performance. I now use actimeo=3
(3 seconds) and see a much lower drag.
Reference NFS mounting configuration in fstab:
203.0.113.0:/home /nfs/home nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0