• RHEL中如何控制页面缓存的大小?


    环境

    • Red Hat Enterprise Linux (RHEL) 4, 5, 6, 7, 8

    问题

    • How to control the size of the page cache in Red Hat Enterprise Linux?

    决议

    • In RHEL 4, 5, 6, 7 and 8 the page cache is dynamically adjusted. There is no kernel parameter to control its size directly.

    • However, it is possible to indirectly influence the page cache size via tuning of the virtual memory settings.

    • The primary sysctl tunables (along with their default values) for controlling the behaviour of the page cache are as follows:

      • vm.vfs_cache_pressure (default = 100)

        • At the default value of vfs_cache_pressure=100 the kernel will attempt to reclaim dentries and inodes at a "fair" rate with respect to pagecache and swapcache reclaim.
        • Controls the tendency of the kernel to reclaim the memory which is used for caching of directory and inode objects.
        • Decreasing vfs_cache_pressure causes the kernel to prefer to retain dentry and inode caches. Increasing vfs_cache_pressure beyond 100 causes the kernel to prefer to reclaim dentries and inodes
        • To limit the size of page cache, you would want to increase this value so the kernel will be more likely to reclaim these objects.
      • vm.dirty_background_ratio (default = 10)

        • Contains, as a percentage of total system memory, the number of pages at which the pdflush background writeback daemon will start writing out dirty data.
        • To limit the size of page cache, decrease this number so the pdflush daemon will start writing out dirty data sooner.
      • vm.dirty_ratio (default = 20)

        • Contains (as a percentage of total system memory) the number of pages at which a process which is generating disk writes will itself start writing out dirty data.
        • To limit the size of page cache, decrease this number so processes will start writing out dirty data sooner.
      • vm.dirty_writeback_centisecs (Red Hat Enterprise Linux 4 and 5: default = 499, Red Hat Enterprise Linux 6, 7 and 8: default = 500)

        • The pdflush writeback daemons will periodically wake up and write "old" data out to disk. This tunable expresses the interval between those wakeups, in 100'ths of a second. Setting this to zero disables periodic writeback altogether.
        • To limit the size of page cache, decrease this value so the pdflush daemon will wake up more often and write dirty data out to disk.
      • vm.dirty_expire_centisecs (Red Hat Enterprise Linux 4 and 5: default = 2999, Red Hat Enterprise Linux 6, 7 and 8: default = 3000)

        • This tunable is used to define when dirty data is old enough to be eligible for writeout by the pdflush daemons. It is expressed in 100ths of a second. Data which has been dirty in-memory for longer than this interval will be written out next time a pdflush daemon wakes up.
        • To limit the size of page cache, decrease this value so data will be considered dirty sooner and will be written out by pdflush.
      • vm.swappiness (RHEL 5 and 6: default = 60, RHEL 7 and 8: default = 30)

        • This controls how likely the vm is to swap out inactive memory pages (the higher the value, the more likely it is to swap).
        • To limit the size of page cache, decrease this value so the kernel is less likely to swap and thus more likely to drop pages from the page cache.
        • A value of zero here does not prevent the system from swapping.
    • You do not need to reboot for sysctl changes to take effect.

    • Modifications to these values could effect a significant change in behavior and performance of the system (positive or negative). It is highly recommended that you modify them slightly at first and test each change thoroughly to ensure they do not have any negative effects in your environment.

    • For further details please check the following documents that are contained in the kernel-doc package: /usr/share/doc/kernel-doc-$VERSION/Documentation/{filesystems/proc.txt, sysctl/vm.txt}.

  • 相关阅读:
    python3 爬取西祠代理IP数据
    电影天堂电影链接爬取
    腾讯招聘信息爬取
    妹子图图片爬取
    我爱我家数据爬取
    今日头条网页图片爬取
    快乐的正则一只
    百思不得姐首页爬取
    雪球网数据爬取
    Python Day79 form表单
  • 原文地址:https://www.cnblogs.com/augusite/p/14944038.html
Copyright © 2020-2023  润新知