How to clear nfs attribute cache?

I need to find a way to flush the client-side NFS attribute cache. Stat () causes ctime to be read from the attribute cache, and not the actual value, it takes up to 3 seconds for the actual value to be reflected in the cache. using the "noac" parameter during installation, but will affect long-term performance.

I came across solutions like executing chown on the same file owner, etc., but is there a way to clear the attribute cache before stat () is executed? and this problem only occurs on Redhat Linux and not on FreeBSD. Can someone explain?

+6
source share
1 answer

This does not apply to NFS, but you can use kernel caching. This is usually done when matching I / O, but it works for NFS as well.

https://www.kernel.org/doc/Documentation/sysctl/vm.txt :

Writing to this will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free. To free pagecache: echo 1 > /proc/sys/vm/drop_caches To free dentries and inodes: echo 2 > /proc/sys/vm/drop_caches To free pagecache, dentries and inodes: echo 3 > /proc/sys/vm/drop_caches As this is a non-destructive operation and dirty objects are not freeable, the user should run `sync' first. 
+3
source

All Articles