MySQL Server SWAP usage is high, which causes db to be very slow and slow. mysqlswap

Source: Internet
Author: User
Tags mysql import

MySQL Server SWAP usage is high, which causes db to be very slow and slow. mysqlswap
High usage of MySQL Server SWAP causes slow db

Environment Introduction:
CentOS: 6.X
MySQL version: 5.5.40
Fault Cause Analysis:
The physical memory is 16 GB, And the swap is 4 GB. MySQL occupies 14 GB of physical memory, while other applications or system processes require 3 GB of memory, at this time, the operating system may map some address spaces owned by MySQL to swap, which may generate swap operation events:

Main causes:
1. mysqldump and mysql import large databases or tables;
2. io writer and io read operations for a large number of concurrent operations at the database layer;
3. copy a large file on the OS layer, such as a database backup file of hundreds of GB.
 
 
Common solution:
1. Release SWAP space
# Swapoff-
Then enable swapon
# Swapon-

2. Add the MySQL Configuration Parameter memlock.
This parameter forces the address space of the mysqld process to be 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. Modify Kernel Parameters
# Echo "vm. swappiness = 0">/etc/sysctl. conf

4. Modify the parameters of my. cnf:
Modify the innodb_flush_method parameter in my. cnf to enable the O_DIRECT mode.

5. Use the large page memory.
Reference: http://blog.csdn.net/jacson_bai/article/details/44755109

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.