MySQL server swap usage high results in db very slow very card
Environment Introduction:
centos:6.x
MySQL version: 5.5.40
Failure Reason analysis:
The physical memory is 16g,swap is 4G. At this point, MySQL itself has taken up 14G of physical memory, while other applications or system processes need 3G of memory, this time the operating system may have a portion of MySQL's own address space mapped to the swap, it is possible to generate swap operation events:
The main causes of the production:
1.mysqldump and MySQL import a large library or table;
2. Io writer and IO read operations for large batches of concurrent operations in the database layer;
3. Copy a large file in the OS layer, such as hundreds of gigabytes of database backup files.
The usual solution:
1. Free swap Space
#swapoff-A
Then turn on Swapon.
#swapon-A
2. Add MySQL configuration Parameters Memlock
This parameter forces the address space of the mysqld process to remain locked in the physical memory.
Set Max locked Memory
#echo "MySQL hard memlock Unlimited" >>/etc/security/limits.conf
#echo "MySQL soft memlock unlimited" >>/etc/security/limits.conf
3. Modifying kernel parameters
#echo "Vm.swappiness=0" >>/etc/sysctl.conf
4. Modify the MY.CNF parameter:
Modify the Innodb_flush_method parameter inside the my.cnf to turn on O_direct mode.
5. Use large page memory.
Reference Link: http://blog.csdn.net/jacson_bai/article/details/44755109
MySQL server swap usage high results in db very slow very card