|
Компьютерный форум OSzone.net » Linux и FreeBSD » Общий по Linux » Redhat/Fedora - Как ограничить объем памяти, используемый Linux под buff/cache память? |
|
Redhat/Fedora - Как ограничить объем памяти, используемый Linux под buff/cache память?
|
Новый участник Сообщения: 28 |
Профиль | Отправить PM | Цитировать Всем привет! Очень мне не нравится, что в Линукс так свободно (как гно в проруби) болтается память, выделяемая под кэширование файловых операций ввода-вывода. У меня все жестко в системе - в ящике столько-то ОЗУ, из него столько-то памяти выделено под базу данных (Оракл), и все было бы хорошо, если бы не прыгающий туда-сюда buff/cache!!! То он 100 Мб, то 900 Мб, то опять 600. Из-за этого я не могу выделить памяти базе больше. Ибо если я пытаюсь это сделать, косвенно требуя от Линукс передать память от файловых буферов базе данных, то кажется мне, что это не срабатывает, и buff/cache начинает дико свопить, сливая накопленные в файловом кэше данные на диск, и упорно считая, что под buff/cache должно выделяться от 0 до 1 Гб ОЗУ. А если это не получается разместить в ОЗУ, то оно прет в своп. Я бы хотел в ОС память жестко под buff/cache выделить (скажем, 50 Мб), а освободившуюся память отдать базе. У Оракла свои механизмы работы с кэшем базы данных, и buff/cache не кэширует потоки из кэша базы к/от файлам базы. Как это сделать?!
Фразы типа "Linux always tries to use RAM to speed up disk operations by using available memory for buffers (file system metadata) and cache (pages with actual contents of files or block devices). This helps the system to run faster because disk information is already in memory which saves I/O operations. If space is needed by programs or applications like Oracle, then Linux will free up the buffers and cache to yield memory for the applications." я уже читал. Не всем и не всегда такая политика подходит. В ситуации, когда ты вручную конфигурируешь память туда, сюда и вооон туда, неподдающийся управлению компонент в виде самовольно растущей или сжимающейся buff/cache памяти очень сильно раздражает и сковывает. |
|
Отправлено: 16:10, 14-12-2018 |
Ветеран Сообщения: 3806
|
Профиль | Отправить PM | Цитировать Цитата GrayMagellan:
Цитата Jula0071:
|
||
Отправлено: 16:33, 17-12-2018 | #11 |
Для отключения данного рекламного блока вам необходимо зарегистрироваться или войти с учетной записью социальной сети. Если же вы забыли свой пароль на форуме, то воспользуйтесь данной ссылкой для восстановления пароля. |
Забанен Сообщения: 6345
|
Цитата Busla:
|
|
Отправлено: 17:51, 17-12-2018 | #12 |
Новый участник Сообщения: 28
|
Профиль | Отправить PM | Цитировать Цитата Jula0071:
Linux-x86_64 Error: 1: Operation not permitted" . Цитата Jula0071:
|
||
Отправлено: 17:54, 17-12-2018 | #13 |
Забанен Сообщения: 6345
|
Цитата GrayMagellan:
|
|
Отправлено: 17:59, 17-12-2018 | #14 |
Новый участник Сообщения: 28
|
Профиль | Отправить PM | Цитировать Цитата Jula0071:
Цитата Jula0071:
"...The term "swappiness" refers to the likeliness of the system to use swap. This works on a scale of 0-100 where zero means indicates the swap will never be used and 100 is excessive use. Most Linux distros have a default of about "60"...". Хотя наверное этот параметр не совсем то, что мне нужно. Во-первых, я не хочу ограничивать своп, т.к. я и так ограничиваю систему по ОЗУ. Если я ограничу систему по свопу, то у нее не останется пространства для маневра памятью и она должна просто рухнуть. Во-вторых, это согласно перевода "желание" использовать операционкой своп. А мне не своп, а страничный кэш ограничить надо. |
||
Отправлено: 18:23, 17-12-2018 | #15 |
Новый участник Сообщения: 28
|
Профиль | Отправить PM | Цитировать Цитата Jula0071:
|
|
Отправлено: 18:46, 17-12-2018 | #16 |
Новый участник Сообщения: 28
|
Профиль | Отправить PM | Цитировать Все-таки я пока хочу решить частную задачу - ограничить страничный кэш объемом 50 Мб. Все, что в него не поместится - пусть через дисковый ввод-вывод проходит.
|
Отправлено: 18:50, 17-12-2018 | #17 |
Новый участник Сообщения: 13
|
Профиль | Отправить 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}. Цитата:
Скрытый текст
# 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). Цитата:
|
||
Последний раз редактировалось RoseHill, 17-12-2018 в 21:17. Отправлено: 21:10, 17-12-2018 | #18 |
Новый участник Сообщения: 28
|
Профиль | Отправить PM | Цитировать Цитата RoseHill:
Цитата RoseHill:
Цитата RoseHill:
А не наступил ли у меня пипец? AnonHugePages: 0 kB ShmemHugePages: 0 kB HugePages_Total: 3268 HugePages_Free: 3097 HugePages_Rsvd: 2286 HugePages_Surp: 0 Hugepagesize: 2048 kB Если я сложу Free+Rsvd, то получится 5383 страницы. Что явно больше заданного мной 3268 шт. Гм... Пока писал, показания стали такие: AnonHugePages: 0 kB ShmemHugePages: 0 kB HugePages_Total: 3268 HugePages_Free: 816 HugePages_Rsvd: 5 HugePages_Surp: 0 Hugepagesize: 2048 kB Вот последние цифры уже похожи на правду. Я планировал под SGA отдать 4902 Мб. Если посчитать, то получается близкая величина: (3268шт.-816шт.)*2Мб=4094Мб. Гм... Ровно на 2 Мб больше, чем я планировал. Где у меня косяк вкрался? И меня смущает, что 816 страниц болтаются во Free. За счет чего же тогда PGA взяла память?! Должна была за счет этих 816 страниц взять. |
|||
Последний раз редактировалось GrayMagellan, 18-12-2018 в 17:24. Отправлено: 17:11, 18-12-2018 | #19 |
Новый участник Сообщения: 28
|
Профиль | Отправить PM | Цитировать В общем... Я не стал разбивать себе голову (вернее, у меня не получилось), пытаясь косвенными параметрами ограничить объем страничного кэша. Вместо этого я пошел по другому пути и базу настроил по-другому. Вроде работает... Пока, по крайней мере... Пока база пустая. Дальше буду восстанавливать схемы и пробовать её в работе. Всем откликнувшимся спасибо за советы!
|
Отправлено: 16:48, 19-12-2018 | #20 |
Участник сейчас на форуме | Участник вне форума | Автор темы | Сообщение прикреплено |
| |||||
Название темы | Автор | Информация о форуме | Ответов | Последнее сообщение | |
HDD - Пропала вся память и объем жесткого диска | Dimoriz | Накопители (SSD, HDD, USB Flash) | 4 | 01-02-2016 01:07 | |
Разное - [решено] Как ограничить использование оперативной памяти ? | berk2030 | Microsoft Windows 2000/XP | 10 | 02-10-2013 20:21 | |
Разное - Как ограничить память процессу ? | kpripper | Microsoft Windows 7 | 2 | 13-11-2011 00:19 | |
Win 2003 SP1 - Как ограничить количество подключений под одним логином? | allzero | Microsoft Windows NT/2000/2003 | 7 | 19-01-2009 14:19 | |
Реальный объем памяти | kapitanvagin | Хочу все знать | 6 | 05-01-2009 18:45 |
|