大网数据广告活动
服务器运维问答

Unusually high nfs_inode_cache

· 52CE 我爱测

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 tr…

问题原文

原帖链接 · user1335838 · CC BY-SA 3.0

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

社区高分解答

原帖链接 · Thomas Guyot-Sionnest · CC BY-SA 4.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2014-06-17)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。