My server is experiencing a high usage of nfs_inode_cache = 11G , im trying to figure out what's consuming all this , i know already that directories with large numbers of entries and deep directory structures are searched and traversed by some java applications.

Is there any way to look into the dentry cache to see what all this memory is (what are the paths that are being cached)?

Here is my slabtop command :

8603424 8603424 100%    1.01K 2867808        3  11471232K nfs_inode_cache
3080826 3080737  99%    0.21K 171157       18    684628K dentry_cache
 24717  12515  50%    0.52K   3531        7     14124K radix_tree_node
 11365  11108  97%    0.74K   2273        5      9092K ext3_inode_cache

Here is my cache pressure : cat /proc/sys/vm/vfs_cache_pressure 100


Are you experiencing any issue? What does your RAM usage looks like? (ex. free -m)

It's perfectly normal for Linux to use whatever's RAM available for caching - some of it will show through slabtop (dentries, inodes, etc.) and the rest through free -m' cached memory (pagecache/swapcache).

/proc/sys/vm/vfs_cache_pressure controls the proportions by which the kernel will free them. 100 is the default "fair" setting. Reducing this value favors pruning pagecache (i.e. file contents) while increasing it favors pruning filesystem metadata (inodes, etc...). In any case, cache pruning will happen only under memory presure; if you have plenty of unused memory the kernel will keep it used for caching.

Probably a much more important setting is vm.swappiness - this one controls the kernel's behavior to swap out memory vs. reclaim cache memory. The default value is good in most cases, but if you see processes hung/swapped out during periods of intensive IO with way more cached ram than you need then you most likely want to reduce this one. Additionally, if you have huge amount of memory and a fairly old kernel you may need to adjust one of these parameters as well (either the *bytes or *ratio, not both!):

  • dirty_background_bytes
  • dirty_background_ratio
  • dirty_bytes
  • dirty_ratio

All these settings are fully documented here: https://www.kernel.org/doc/Documentation/sysctl/vm.txt

However if you're not experiencing any issue, hung processes, excessive swapping out, etc. then I suggest not changing the defaults.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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