MySQL server swap usage high results in db very slow very card

Source: Internet
Author: User
Tags mysql version mysql import

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.