Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am planning to use NFS to serve out many small files. They will be read very often so client side caching is crucial. Does NFS handle this? Is there a way to increase the client side caching in some way?

...or should I look at another solution? Syncing using rsync or unison periodically is not an option since the files are modified on the client side from time to time.

share|improve this question
up vote 5 down vote accepted

First, NFS does not provide cache coherency, so if you need that, you must look elsewhere.

What NFS specifies is a weaker model called close-to-open consistency. Meaning that when a file is closed, any dirty data are flushed to the server. Conversely, when a file is opened, an attribute check is performed, meaning that if the client has cached pages from that file, it checks whether those pages are still valid.

While not in the spec itself, most NFS clients have something called attribute cache timeout, i.e. how old the attributes of a directory or opened file can be before the client contacts the server to revalidate them. On Linux, see the actimeo= etc. mount options. Higher values allow more aggressive caching, but increase the risk of using stale data if some other client updated the file in the meantime.

share|improve this answer
Thank you for your reply. So, just so that I've understood this correctly, the client side "attribute cache" only contains a cache for file/dir-attributes ie. the cache doesn't contain any file content? – Ztyx Apr 8 '10 at 7:26
Yes, the client caches file content in the page cache, just like it does for a local filesystem. The attributes are used to decide if and when the cached file contents are invalidated. – janneb Apr 8 '10 at 10:35
Ah. Thank you so much for answering this. Have a nice day. – Ztyx Apr 8 '10 at 13:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.