Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Новый участник


Сообщения: 13
Благодарности: 2

Профиль | Отправить PM | Цитировать


How to control the size of page cache in RHEL


How to control the size of page cache in RHEL?
Solution Проверено - Обновлено March 15 2018 at 9:32 PM - English
Окружение

Red Hat Enterprise Linux 7
Red Hat Enterprise Linux 6
Red Hat Enterprise Linux 5
Red Hat Enterprise Linux 4

Вопрос

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

Решение

In RHEL 4, 5, 6 and 7 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 & 5: default = 499, Red Hat Enterprise Linux 6 and 7: 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 and 7: 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: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}.



Цитата:
и выяснилось, что у меня в Oracle Linux 7.6 (он же Red Hat 7.6) такого параметра в /proc/sys/vm/ нету . Отменили его в последних версиях Линукса?
Это каталог, там хранятся значения ранее заданных параметров. Достаточно прочитать заголовок /etc/sysctl.conf
Скрытый текст

# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).


Цитата:
На портале Red Hat я про него очень мало информации нашел (или она закрыта платной подпиской)
На портале Red Hat в тамошней базе данных об этом всём читать не перечитать. ))) Для того, чтобы читать, надо зарегистрироваться на портале разработчиков Red Hat, получить тем самым годовую бесплатную подписку и пользоваться базой "вопросов-ответов" Red Hat в полном объёме. Чтобы зарегистрироваться разработчиком на портале разработчиков Red Hat от вас требуется мыл на не публичном домене. Сгодится какой угодно уровень домена. Если у вас вдруг и неожиданно нет ни одного своего домена и даже третьего уровня, то попросите друга завести вам на время регистрации почту. Red Hat-у абсолютно безразлично сколько подписок было на один домен, допустим второго уровня, лишь бы почты были разные. Но я не думаю, что для создания почты на непубличном домене требуется помощь друга. ))

Последний раз редактировалось RoseHill, 17-12-2018 в 21:17.


Отправлено: 21:10, 17-12-2018 | #18