Linux 缓存驱逐

Linux 缓存驱逐

看看我的 Linux 机器上的 VFS 缓存的行为方式,我可以看到,即使在有效空闲时(crond 和大多数其他守护进程停止,接口关闭),可用内存量也会逐渐增加,这意味着项目正在从缓存中逐出。

我做了很多谷歌搜索,但找不到任何关于如何控制它的参考(除非它是 vm_swappiness 的副作用)。任何人都可以让我走上正确的道路来理解为什么在不需要新的内存分配时项目会被从缓存中逐出吗?

答案1

swappiness 仅影响分配的应用程序内存是否被换出以为缓存腾出空间。 vfs_cache_Pressure 是控制您所看到的内容的 sysctl。

答案2

Linux 使用名为的进程刷新页面缓存中的数据pdflush

pdflush 由以下参数控制/proc/sys/虚拟机

#/proc/sys/vm/dirty_expire_centisecs
The hundredth of the second after which data will be considered to be expired from the page cache and will be written at the next opportunity.

#/proc/sys/vm/dirty_writeback_centisecs`    
The hundredth of a second after which the pdflush wakes up to write data to disk.

#/proc/sys/vm/vfs_cache_pressure`    
This will reclaim dentries and inodes which are also part of the cache.

您可以查看以下主题以获取更多信息:

pdflush 守护进程
写重负载的操作和调整理论
Linux 缓存

相关内容