Swappiness
get current setting
get
sysctl kernel.ostype
$ sysctl -a
$ sysctl -a | grep kernel
$ sysctl -a | more
ie swappiness
https://www.howtogeek.com/449691/what-is-swapiness-on-linux-and-how-to-change-it/
cat /proc/sys/vm/swappiness
sudo sysctl vm.swappiness=0
or
sudo sh -c ‘echo 0 > /proc/sys/vm/swappiness’
persistent
old
/etc/sysctl.conf
# backup
sudo cp -p /etc/sysctl.conf /etc/sysctl.conf.`date +%Y%m%d-%H:%M`
sudo sh -c 'echo "" >> /etc/sysctl.conf'
#or
sudo vi /etc/sysctl.conf
# add `vm.swappiness = 0`
## apply configu
sysctl -p
automatiquement
sudo sh -c 'echo "" >> /etc/sysctl.conf'
sudo sh -c 'echo "#Set swappiness to 0 to avoid swapping `date +%Y%m%d-%H:%M`" >> /etc/sysctl.conf'
sudo sh -c 'echo "vm.swappiness = 0" >> /etc/sysctl.conf'
new (.d)
sysctl how to configure
https://www.cyberciti.biz/faq/reload-sysctl-conf-on-linux-using- sysctl/
/etc/sysctl.d/
cat /etc/sysctl.d/99-swappiness.conf
vm.swappiness=10
How to reload sysctl.conf variables on Linux
Type the following command to reload settings from config files without rebooting the box:
sysctl --system
The settings are read from all of the following system configuration files:
/run/sysctl.d/*.conf
/etc/sysctl.d/*.conf
/usr/local/lib/sysctl.d/*.conf
/usr/lib/sysctl.d/*.conf
/lib/sysctl.d/*.conf
/etc/sysctl.conf
note
/etc/sysctl.conf
vm.swappiness = 1
vm.dirty_background_ratio = 3
vm.dirty_ratio = 80
vm.dirty_expire_centisecs = 500
vm.dirty_writeback_centisecs = 100
kernel.shmmax = 4398046511104
kernel.shmall = 1073741824
kernel.shmmni = 4096
sysctl -p
sysctl -p /etc/sysctl.d/99-swappiness.conf
32 bits = 32768 2^16
64 bits = 4194304 2^22
max pid
bash fork cannot allocate memory
temporary
cat /proc/sys/kernel/pid_max
echo 32768 > /proc/sys/kernel/pid_max
permanent
/etc/sysctl.conf or /etc/sysctl.d/98-pid_max.conf
kernel.pid_max = 4194304