Does NFS client cache?

Frank Leonhardt frank2 at
Thu Aug 31 14:35:01 UTC 2017

On 30/08/2017 21:13, Rafal Lukawiecki wrote:
> Apologies for my FreeBSD newbieness…coming from CentOS/Amazon Linux and on a fast knowledge ramp-up at the moment.
> I would like to know if the NFS client in FreeBSD performs any/some/none caching of the files clients fetch. I am used to installing fscache (cachefilesd, see on Linuxes, with an fstab mount flag “fsc” to perform persistent caching to the local *disk*. This gives me significant performance improvements on the Linuxes I have used. Is this not done at all, or done in some other way on FreeBSD? I could not find any relevant ports.
> The use case is cloud-based servers caching centrally managed NFS files that contain rarely changing config and dev data, however all speed-critical data is locally rsynced.
> Many thanks and my regards from Ireland,
> Rafal
> --

Sometimes :-) NFS caching is a problem, especially when you consider the 
effects of fsync() and being POSIX compliant in this respect. If you 
cache a file, even R/O, then an fsync() operation on one host must 
invalidate the cache on ALL other hosts before returning. Strictly 
speaking. In practice there are a lot of kernel tuneables to ignore this 
(some undocumented IME). You can also comment out the code that deals 
with the fsync() requests.

Best strategy depends on exactly what you're trying to do. I'd probably 
copy files to local storage as a cron job as an early option.

(Thanks for the info on AWS)

Regards, Frank.

More information about the freebsd-questions mailing list