Use cgroups to limit the resource occupation of MySQL Enterprise Backup

Source: Internet
Author: User

Use cgroups to limit the resource occupation of MySQL Enterprise Backup

Today, I encountered a problem: MySQL Enterprise Backup caused a heavy load on the I/O subsystem, slow application response, and system unavailability. So I want to restrict the mysqlbackup process so that it will not cause more problems.

The mysqlbackup command contains the read, write, and process count settings. The default value is 1 read, 1 write, and 5 threads. Because I use the default settings, there is no need to adjust them.

The ionice tool cannot work because it requires the cfg I/O scheduler.

I found a method in this article. It uses linux cgroups. Previously, when a server on the three platforms was using a very slow CPU, I used cgroups to test the installation of a galera.

# 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 26/dev/mapper/vgdb01-lvdb01-> ../dm-2
# Ls-lh/dev/dm-2
Brw-rw ---- 1 root disk 253, 2 Sep 26/dev/dm-2
# Cgset-r blkio. throttle. read_iops_device = "253: 2 20" mysqlbackup
# Cgset-r blkio. throttle. write_iops_device = "253: 2 20" mysqlbackup
# Echo $>/cgroup/blkio/mysqlbackup/tasks
# Cat/proc/$/cgroup
1: blkio:/mysqlbackup
# Mysqlbackup -- user = root -- password = xxxxxx -- with-timestamp -- backup-dir =/data/backup

It works exactly the same way as I expected. Read and Write operations are limited to 20 iops.

Later I found it was a storage system problem, so I didn't use this method in the production environment, but I hope this will help others. It may also be useful in other cases.

This article permanently updates the link address:

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.