It is the job of the linux 'oom killer' to sacrifice one or more processes in order to free up memory for the system when all else fails. It will also kill any process sharing the same mm_struct as the selected process, for obvious reasons. Any particular process leader may be immunized against the oom killer if the value of its /proc/<pid>/oomadj is set to the constant OOM_DISABLE (currently defined as -17).
Genelde ram tükendiğinde oom killer çalışan normal işlemleri öldürmeye başlar.
sshd islemlerinin oom_adj parametresini kontrol ettigimizde,
pgrep sshd | while read PID; do echo $PID;cat /proc/$PID/oom_adj;done
1244
-17
6425
0
ssh servisine kural ve sshd dokunma diyoruz.
~# cat /etc/systemd/system/sshd.service
[Unit]
Description=OpenBSD Secure Shell server
Documentation=man:sshd(8) man:sshd_config(5)
After=network.target auditd.service
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run
[Service]
DefaultLimitNICE=-19
OOMPolicy=continue
OOMScoreAdjust=-1000
EnvironmentFile=-/etc/default/ssh
ExecStartPre=/usr/sbin/sshd -t
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
ExecReload=/usr/sbin/sshd -t
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=notify
RuntimeDirectory=sshd
RuntimeDirectoryMode=0755
[Install]
WantedBy=multi-user.target
Alias=sshd.service
#
# systemctl daemon-reload
# systemctl restart sshd
# pgrep sshd | while read PID; do echo $PID;cat /proc/$PID/oom_adj;done
8409
-17
8454
-17
#
Artik sshd islemleri oom kiler tarafindan oldurulmeyecektir.
Hiç yorum yok:
Yorum Gönder