Impact of vm. swappiness on databases
The default vm. swappiness value of centos is 60. You can reduce the size of the database to reduce the load of swap, and improve the system performance.
In linux, once swap partition is used, swap switching is triggered only when pages are missing. Otherwise, swap is used all the time, resulting in extremely high hard disk I/O.
For oracle, 10 is generally set. For mysql, 1 is generally set. Do not use swap partitions as much as possible. If it is set to 0, linux will also use swap partitions,
If the value of the kernel after 3.5 and the kernel after redhat 2.6.32 is set to 0, swap is disabled, causing mysql oom.
View swappiness in your system
$ Cat/proc/sys/vm/swappiness
If nothing happens, you should see 60.
Temporarily change the value of swappiness to 10
$ Sudo sysctl vm. swappiness = 10
After the system is restarted, the default 60 is restored.
$ Sudo gedit/etc/sysctl. conf
Add the following line at the end of this document:
Vm. swappiness = 10
Save and restart.