5

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 :

   OBJS ACTIVE  USE OBJ SIZE  SLABS OBJ/SLAB CACHE SIZE NAME
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

2
  • What versions of RHEL are you using? There was a known issue related to this awhile ago. access.redhat.com/solutions/481743 Jan 22, 2015 at 19:49
  • The question in your link doesn't mention any issue and since most readers won't have access to the answer I won't even bother logging in. If there's a real issue there should be related posts on lkml or linux-mm. There is just no point in freeing any cache while it's still valid unless memory can be used for something more important. Nov 17, 2023 at 0:58

1 Answer 1

4

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .