update readme and conf
This commit is contained in:
parent
17653f67e0
commit
eb0b1d9356
25
README.md
25
README.md
@ -64,17 +64,17 @@ MemAvail: 4610 M, 78.5 % | SwapFree: 9024 M, 83.9 %
|
|||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
|
|
||||||
- Linux 3.14+
|
- `Linux 3.14+` (because the MemAvailable parameter appeared in /proc/meminfo since kernel version 3.14) and `Python 3.4+` (compatibility with earlier versions was not tested) for basic usage
|
||||||
- Python 3.4+
|
- `libnotify` (Fedora, Arch) or `libnotify-bin` (Debian, Ubuntu) for desktop notifications and `sudo` for desktop notifications as root
|
||||||
|
|
||||||
### Memory and CPU usage
|
### Memory and CPU usage
|
||||||
|
|
||||||
- VmRSS is 10 - 14 MiB depending on the settings
|
- VmRSS is 10 — 13.5 MiB depending on the settings
|
||||||
- CPU usage depends on the level of available memory (the frequency of memory status checks increases as the amount of available memory decreases) and monitoring intensity (can be changed by user via config)
|
- CPU usage depends on the level of available memory (the frequency of memory status checks increases as the amount of available memory decreases) and monitoring intensity (can be changed by user via config)
|
||||||
|
|
||||||
### Status
|
### Status
|
||||||
|
|
||||||
The program is unstable and some fixes are required before the first stable version will be released. (Need documentation, translation, review.)
|
The program is unstable and some fixes are required before the first stable version will be released (need documentation, translation, review and some optimisation).
|
||||||
|
|
||||||
### Download
|
### Download
|
||||||
|
|
||||||
@ -110,9 +110,22 @@ optional arguments:
|
|||||||
|
|
||||||
### How to configure nohang
|
### How to configure nohang
|
||||||
|
|
||||||
Just read the config and edit values. Run the command `sudo systemctl restart nohang` to apply changes.
|
The program can be configured by editing the config file. The configuration includes the following sections:
|
||||||
|
|
||||||
|
- I. STANDARD OUTPUT VERBOSITY
|
||||||
|
- II. SELF-DEFENSE
|
||||||
|
- III. INTENSITY OF MONITORING
|
||||||
|
- IV. THRESHOLDS FOR SENDING SIGNALS
|
||||||
|
- V. PREVENTION OF KILLING INNOCENT VICTIMS
|
||||||
|
- VI. DESKTOP NOTIFICATIONS
|
||||||
|
- VII. AVOID AND PREFER VICTIM NAMES VIA REGEX
|
||||||
|
- VIII. LOGGING
|
||||||
|
- IX. LOW MEMORY WARNINGS
|
||||||
|
- X. EXECUTE THE COMMAND INSTEAD OF SENDING THE SIGTERM SIGNAL
|
||||||
|
|
||||||
|
Just read the description of the parameters and edit the values. Run the command `sudo systemctl restart nohang` to apply changes.
|
||||||
|
|
||||||
### Feedback
|
### Feedback
|
||||||
|
|
||||||
Please create [issues](https://github.com/hakavlad/nohang/issues).
|
Please create [issues](https://github.com/hakavlad/nohang/issues). Use cases, feature requests and any questions are welcome.
|
||||||
|
|
||||||
|
10
nohang
10
nohang
@ -1208,7 +1208,7 @@ if print_config:
|
|||||||
print('print_mem_check_results: {}'.format(print_mem_check_results))
|
print('print_mem_check_results: {}'.format(print_mem_check_results))
|
||||||
print('print_sleep_periods: {}'.format(print_sleep_periods))
|
print('print_sleep_periods: {}'.format(print_sleep_periods))
|
||||||
|
|
||||||
print('\nII. SELF-DEFENSE')
|
print('\nII. SELF-DEFENSE [displaying these options need fix]')
|
||||||
print('mlockall: {} ({})'.format(mlockall, mla_res))
|
print('mlockall: {} ({})'.format(mlockall, mla_res))
|
||||||
print('self_nice: {} ({})'.format(
|
print('self_nice: {} ({})'.format(
|
||||||
self_nice, self_nice_result
|
self_nice, self_nice_result
|
||||||
@ -1217,12 +1217,12 @@ if print_config:
|
|||||||
self_oom_score_adj, self_oom_score_adj_result
|
self_oom_score_adj, self_oom_score_adj_result
|
||||||
))
|
))
|
||||||
|
|
||||||
print('\nIII. MONITORING INTENSITY')
|
print('\nIII. INTENSITY OF MONITORING')
|
||||||
print('rate_mem: {}'.format(rate_mem))
|
print('rate_mem: {}'.format(rate_mem))
|
||||||
print('rate_swap: {}'.format(rate_swap))
|
print('rate_swap: {}'.format(rate_swap))
|
||||||
print('rate_zram: {}'.format(rate_zram))
|
print('rate_zram: {}'.format(rate_zram))
|
||||||
|
|
||||||
print('\nIV. THRESHOLDS FOR SENDING SIGNALS')
|
print('\nIV. THRESHOLDS FOR SENDING SIGNALS [displaying these options need fix]')
|
||||||
|
|
||||||
print('mem_min_sigterm: {} MiB, {} %'.format(
|
print('mem_min_sigterm: {} MiB, {} %'.format(
|
||||||
round(mem_min_sigterm_mb), round(mem_min_sigterm_percent, 1)))
|
round(mem_min_sigterm_mb), round(mem_min_sigterm_percent, 1)))
|
||||||
@ -1255,7 +1255,7 @@ if print_config:
|
|||||||
print('notify_options: {}'.format(notify_options))
|
print('notify_options: {}'.format(notify_options))
|
||||||
print('root_display: {}'.format(root_display))
|
print('root_display: {}'.format(root_display))
|
||||||
|
|
||||||
print('\nVII. BLACK, WHITE, AVOID AND PREFER LISTS')
|
print('\nVII. AVOID AND PREFER VICTIM NAMES VIA REGEX')
|
||||||
print('use_regex_lists: {}'.format(use_regex_lists))
|
print('use_regex_lists: {}'.format(use_regex_lists))
|
||||||
if use_regex_lists:
|
if use_regex_lists:
|
||||||
print('whitelist_regex: {}'.format(whitelist_regex))
|
print('whitelist_regex: {}'.format(whitelist_regex))
|
||||||
@ -1285,7 +1285,7 @@ if print_config:
|
|||||||
|
|
||||||
|
|
||||||
print('\nX. EXECUTE THE COMMAND INSTEAD OF SENDING THE SIGTERM SIGNAL')
|
print('\nX. EXECUTE THE COMMAND INSTEAD OF SENDING THE SIGTERM SIGNAL')
|
||||||
print('execute_the_command: {}'.format(execute_the_command))
|
print('execute_the_command: {}'.format(execute_the_command))
|
||||||
if execute_the_command:
|
if execute_the_command:
|
||||||
print('\nPROCESS NAME COMMAND TO EXECUTE')
|
print('\nPROCESS NAME COMMAND TO EXECUTE')
|
||||||
for key in etc_dict:
|
for key in etc_dict:
|
||||||
|
81
nohang.conf
81
nohang.conf
@ -1,7 +1,23 @@
|
|||||||
|
|
||||||
This is nohang config file.
|
This is nohang config file.
|
||||||
|
|
||||||
Lines beginning with #, tabs and spaces are comments.
|
Lines starting with #, tabs and spaces are comments.
|
||||||
|
|
||||||
|
The configuration includes the following sections:
|
||||||
|
|
||||||
|
I. STANDARD OUTPUT VERBOSITY
|
||||||
|
II. SELF-DEFENSE
|
||||||
|
III. INTENSITY OF MONITORING
|
||||||
|
IV. THRESHOLDS FOR SENDING SIGNALS
|
||||||
|
V. PREVENTION OF KILLING INNOCENT VICTIMS
|
||||||
|
VI. DESKTOP NOTIFICATIONS
|
||||||
|
VII. AVOID AND PREFER VICTIM NAMES VIA REGEX
|
||||||
|
VIII. LOGGING
|
||||||
|
IX. LOW MEMORY WARNINGS
|
||||||
|
X. EXECUTE THE COMMAND INSTEAD OF SENDING THE SIGTERM SIGNAL
|
||||||
|
|
||||||
|
Just read the description of the parameters and edit the values.
|
||||||
|
Please restart the program after editing the config.
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
@ -52,12 +68,11 @@ self_oom_score_adj = -100
|
|||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
III. MONITORING INTENSITY
|
III. INTENSITY OF MONITORING
|
||||||
|
|
||||||
Коэффициенты, влияющие на интенсивность мониторинга.
|
Coefficients that affect the intensity of monitoring. Reducing
|
||||||
Допустимыми значениями являются положительные числа.
|
the coefficients can reduce CPU usage and increase the periods
|
||||||
Уменьшение коэффициентов способно снизить нагрузку на
|
between memory checks.
|
||||||
прцессор и увеличить периоды между проверками памяти.
|
|
||||||
|
|
||||||
Почему три коэффициента, а не один? - Потому что скорость
|
Почему три коэффициента, а не один? - Потому что скорость
|
||||||
наполнения свопа обычно ниже скорости наполнения RAM.
|
наполнения свопа обычно ниже скорости наполнения RAM.
|
||||||
@ -69,6 +84,10 @@ self_oom_score_adj = -100
|
|||||||
достаточно хорошо, успешно справляясь с резкими скачками потребления
|
достаточно хорошо, успешно справляясь с резкими скачками потребления
|
||||||
памяти.
|
памяти.
|
||||||
|
|
||||||
|
Default values are well for desktop.
|
||||||
|
On servers without rapid fluctuations in memory level, the
|
||||||
|
values can be reduced.
|
||||||
|
|
||||||
Valid values are positive floating-point numbers.
|
Valid values are positive floating-point numbers.
|
||||||
|
|
||||||
rate_mem = 6
|
rate_mem = 6
|
||||||
@ -79,14 +98,11 @@ rate_zram = 1
|
|||||||
|
|
||||||
IV. THRESHOLDS FOR SENDING SIGNALS
|
IV. THRESHOLDS FOR SENDING SIGNALS
|
||||||
|
|
||||||
Задание уровней доступной памяти, ниже которых происходит
|
Sets the available memory levels below which SIGTERM or SIGKILL
|
||||||
отправка сигналов SIGTERM или SIGKILL.
|
signals are sent. The signal will be sent if MemAvailable and
|
||||||
|
SwapFree at the same time will drop below the corresponding
|
||||||
Сигнал отправляется если MemAvailable и SwapFree одновременно
|
values. Can be specified in % (percent) and M (MiB). Valid values
|
||||||
опустятся ниже соответствующих значений.
|
are floating-point numbers from the range [0; 100] %.
|
||||||
|
|
||||||
Can be specified in % (percent) and M (MiB).
|
|
||||||
Valid values are floating-point numbers from the range [0; 100] %.
|
|
||||||
|
|
||||||
mem_min_sigterm = 9 %
|
mem_min_sigterm = 9 %
|
||||||
mem_min_sigkill = 6 %
|
mem_min_sigkill = 6 %
|
||||||
@ -94,15 +110,13 @@ mem_min_sigkill = 6 %
|
|||||||
swap_min_sigterm = 9 %
|
swap_min_sigterm = 9 %
|
||||||
swap_min_sigkill = 6 %
|
swap_min_sigkill = 6 %
|
||||||
|
|
||||||
Задание общей доли zram в памяти, при превышении которой
|
Specifying the total share of zram in memory, if exceeded the
|
||||||
происходит отправка соответствующих сигналов.
|
corresponding signals are sent. As the share of zram in memory
|
||||||
По мере увеличения доли zram в памяти может падать
|
increases, it may fall responsiveness of the system. 90 % is a
|
||||||
отзывчивость системы.
|
usual hang level, not recommended to set very high.
|
||||||
|
|
||||||
Can also be specified in % and M.
|
Can be specified in % and M. Valid values are floating-point
|
||||||
Valid values are floating-point numbers from the range [0; 100] %.
|
numbers from the range [0; 100] %.
|
||||||
90 % is a usual hang level, not recommended to set very high
|
|
||||||
level.
|
|
||||||
|
|
||||||
zram_max_sigterm = 55 %
|
zram_max_sigterm = 55 %
|
||||||
zram_max_sigkill = 60 %
|
zram_max_sigkill = 60 %
|
||||||
@ -118,7 +132,7 @@ zram_max_sigkill = 60 %
|
|||||||
|
|
||||||
Valid values are integers from the range [0; 1000].
|
Valid values are integers from the range [0; 1000].
|
||||||
|
|
||||||
oom_score_min = 20
|
oom_score_min = 10
|
||||||
|
|
||||||
Минимальная задержка после отправки соответствующих сигналов
|
Минимальная задержка после отправки соответствующих сигналов
|
||||||
для предотвращения риска убийства сразу множества процессов.
|
для предотвращения риска убийства сразу множества процессов.
|
||||||
@ -136,8 +150,6 @@ min_delay_after_sigkill = 3
|
|||||||
в значение True, то у процессов, имеющих oom_score_adj выше
|
в значение True, то у процессов, имеющих oom_score_adj выше
|
||||||
oom_score_adj_max значение oom_score_adj будет опущено
|
oom_score_adj_max значение oom_score_adj будет опущено
|
||||||
до oom_score_adj_max перед поиском жертвы.
|
до oom_score_adj_max перед поиском жертвы.
|
||||||
False - не изменять oom_score_adj процессов перед поиском
|
|
||||||
жертвы. Значения чувствительны к регистру!
|
|
||||||
|
|
||||||
Enabling the option requires root privileges.
|
Enabling the option requires root privileges.
|
||||||
Valid values are True and False.
|
Valid values are True and False.
|
||||||
@ -152,7 +164,7 @@ oom_score_adj_max = 20
|
|||||||
|
|
||||||
VI. DESKTOP NOTIFICATIONS
|
VI. DESKTOP NOTIFICATIONS
|
||||||
|
|
||||||
Эта возможность требует наличия notify-send в системе.
|
Включение этой опции требует наличия notify-send в системе.
|
||||||
В Debian/Ubuntu это обеспечивается установкой пакета
|
В Debian/Ubuntu это обеспечивается установкой пакета
|
||||||
libnotify-bin. В Fedora и Arch Linux - пакет libnotify.
|
libnotify-bin. В Fedora и Arch Linux - пакет libnotify.
|
||||||
Также требуется наличие сервера уведомлений.
|
Также требуется наличие сервера уведомлений.
|
||||||
@ -180,7 +192,7 @@ root_display = :0
|
|||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
VII. BLACK, WHITE, AVOID AND PREFER LISTS
|
VII. AVOID AND PREFER VICTIM NAMES VIA REGEX
|
||||||
|
|
||||||
Можно задать регулярные выражения (Perl-compatible regular
|
Можно задать регулярные выражения (Perl-compatible regular
|
||||||
expressions), которые будут использоваться для сопоставления с
|
expressions), которые будут использоваться для сопоставления с
|
||||||
@ -238,8 +250,8 @@ avoidlist_factor = 3
|
|||||||
|
|
||||||
VIII. LOGGING
|
VIII. LOGGING
|
||||||
|
|
||||||
Date, the amount of available memory and OOM prevention progress
|
OOM prevention progress can be logged.
|
||||||
can be logged.
|
|
||||||
Valid values are True and False.
|
Valid values are True and False.
|
||||||
|
|
||||||
logging = True
|
logging = True
|
||||||
@ -263,7 +275,7 @@ low_memory_warnings = False
|
|||||||
|
|
||||||
min_time_between_warnings = 20
|
min_time_between_warnings = 20
|
||||||
|
|
||||||
Уровни MemAvailable и SwapFree одновременно будут ниже
|
Если значения MemAvailable и SwapFree одновременно будут ниже
|
||||||
соотвестствующих значений, то будут отправлены уведомления.
|
соотвестствующих значений, то будут отправлены уведомления.
|
||||||
|
|
||||||
Can be specified in % (percent) and M (MiB).
|
Can be specified in % (percent) and M (MiB).
|
||||||
@ -274,7 +286,7 @@ mem_min_warnings = 20 %
|
|||||||
swap_min_warnings = 20 %
|
swap_min_warnings = 20 %
|
||||||
|
|
||||||
Если доля zram в памяти превысит значение zram_max_warnings,
|
Если доля zram в памяти превысит значение zram_max_warnings,
|
||||||
то будут отправляться уведомления с минимальным периодом
|
то будут отправляться уведомления с минимальным периодом равным
|
||||||
min_time_between_warnings.
|
min_time_between_warnings.
|
||||||
|
|
||||||
zram_max_warnings = 40 %
|
zram_max_warnings = 40 %
|
||||||
@ -299,13 +311,12 @@ execute_the_command = False
|
|||||||
содержащими имена процессов и соотвестствующие команды для
|
содержащими имена процессов и соотвестствующие команды для
|
||||||
перезапуска этих процессов. После имени процесса через двойное
|
перезапуска этих процессов. После имени процесса через двойное
|
||||||
двоеточие (::) следует команда.
|
двоеточие (::) следует команда.
|
||||||
|
Амперсанд (&) в конце команды позволит nohang продолжить работу
|
||||||
|
не дожидаясь окончания выполнения команды.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
** mysqld :: systemctl restart mariadb.service &
|
** mysqld :: systemctl restart mariadb.service &
|
||||||
** php-fpm7.0 :: systemctl restart php7.0-fpm.service &
|
** php-fpm7.0 :: systemctl restart php7.0-fpm.service &
|
||||||
|
|
||||||
Амперсанд (&) в конце команды позволит nohang продолжить работу
|
** processname :: some command
|
||||||
не дожидаясь окончания выполнения команды.
|
|
||||||
|
|
||||||
** processname :: some command &
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user