Increase memory usage on NFS Server

I would like to reduce the memory usage on the clients, since they're continuously producing data and it slows them down.

How do you know this? Most of the client memory is in page cache, which is entirely normal and even improving the buffering on the server wont prevent aggressive caching of this data client side.

Have you tried flushing the page cache (as a test) and seeing how your application performs without the page cache usage?

NFS has whats known as 'close-to-open' consistency, meaning the contents of data and metadata is really only guaranteed to be stable when you've not got the file actively open (that is, another client can change the file on another system and you'd be none the wiser).

Because of this consistency limitation, page cache is relied upon by the NFS client systems applications to ensure the data is available for a read back should that become necessary.

All that being said, without knowing whats going on in your /etc/exports one method to offload more data onto the server might be to ensure you mount NFS on your clients with the sync mount option and on your server export the paths with the async mount option.

This will have the effect of ensuring writes are committed to the server on the client side, whilst the server will always reply 'done' before its committed the data to the disk.

This will impact clients throughput though as you'll be causing latency due to validating every request on the client side, but the server will buffer much more data since it wont wait for the data to land on disk first. You'd also probably want to twiddle the dirty_write_centisecs and other bits on the server to allow it to buffer more data into writeback.

Heres the rub though -- this is likely to cause the clients to slow down and the reduce the servers integrity in the face of crash. If the server crashes you could lose data.

Also, this wont affect memory usage for page cache on the clients which NFS has no real control over.

All in all, I'm skeptical reducing the clients memory usage (if its the page cache you're measuring here) will improve your clients performance.


No, forcing use of less memory is likely to make things slower, not faster. You are spending power on 188 GB of fast DRAM already, might as well use it.

Client host has 188 GB MemTotal, and is using 162 GB of it for Cached. Actually quite low on the memory demands, note 123 GB MemAvailable that can be freed very quickly. Most of the 40 GB of Shmem is probably the tmpfs.

As Cached + Shmem adds up to more than MemTotal, I suspect tmpfs is being counted twice, as shared memory and in caches. Would also explain how Cached minus Shmem is approximately MemAvailable, tmpfs lacking persistent storage cannot be freed.

Server side, 15 GB and change MemTotal, 13 GB in Cached. Plenty of available memory on this host. Presumably, most of what it does it serve files, not a lot else of memory demands.

Without evidence of overhead such as heavy vmscan activity or running low on MemAvailable, I do not recommend taking action.