Use Cgroups to limit the utilization of resources by the Mysql Enterprise backup service _mysql

Source: Internet
Author: User

I have a problem today, MySQL Enterprise backup caused the I/O subsystem load is too large, application response slow, resulting in the system is not available. So I want to limit the mysqlbackup process so that it doesn't cause more problems.

The Mysqlbackup command has a set of read, write, and process numbers. The default is 1 reads, 1 writes, and 5 threads. Because I use the default settings, there is no need to adjust.

Using the Ionice tool does not work because it requires a CFG I/O scheduler.

I found a way in this article. It uses the cgroups of Linux. Before, I used cgroups to test the installation of a galera when one of the three servers was using a very slow CPU.

# Mkdir/cgroup/blkio #
mount-t cgroup-o Blkio Non/cgroup/blkio # cgcreate-g blkio:/mysqlbackup
# LS-LH Dev/mapper/vgdb01-lvdb01
lrwxrwxrwx 1 root 7 Sep 14:22/dev/mapper/vgdb01-lvdb01->. /dm-2
# ls-lh/dev/dm-2
BRW-RW----1 root disk 253, 2 Sep 14:22/dev/dm-2
# cgset-r Blkio.throttle.read_i Ops_device= "253:2" mysqlbackup
# cgset-r blkio.throttle.write_iops_device= "253:2" Mysqlbackup
# echo $$ & Gt /cgroup/blkio/mysqlbackup/tasks
# Cat/proc/$$/cgroup
1:blkio:/mysqlbackup
# mysqlbackup--user= Root--password=xxxxxx--with-timestamp--backup-dir=/data/backup backup

This is a good way to work, exactly as I expected. Both read and write operations are limited to IOPS.

It turned out to be a storage-system problem, so I didn't use it in a production environment, but I hope it helps others. It may also be useful under other issues.

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.