Linux uses Ionice to limit Xen virtual machine disk IO

Source: Internet
Author: User
Tags vps

As a VPS service provider we need to ensure that each VPS fair use of the host (server) resources, to avoid a certain VPS due to program death cycle, hang, abuse and other factors "drag" other VPs, if this happens how to temporarily limit the VPS disk IO it? One way to do this is to limit the IO indirectly and imprecise by modifying the CPU weight of each virtual machine. The usual way to limit resources (CPU, memory, IO, etc.) on Linux is to use cgroups, but the Ionice introduced today is much easier.

First find which virtual machine (VPS) is a large number of IO (assuming vps0001), find this virtual machine with the XM list to identify the use of the virtual machine ID number, and then with the ID blkback (blkback.24) to find out the virtual machine (through the Xen blkback Drives) (Blkback.24.xvda and Blkback.24.xvdb), and the process numbers (25089 and 25090) used:

1 # XM List vps00012 Name ID Mem (MiB) Vcpus state time (s)3vps0001 -     1024x768     2-B----70030.74 5# PS aux | grep blkback. -6Root7434  0.0  0.1  61172   768pts/ -D+ Geneva: -   0:xxgrep blkback. -7Root25089  0.0  0.0      0     0? s< -   0:xx[Blkback. -. Xvda]8Root25090  0.0  0.0      0     0? s< -   0:xx[Blkback. -. Xvdb]

After we find the process number we can ionice:

25089 2 7

Check the Help file before using Ionice,-C is the specified schedule type, here is the 2,best-effort;-n specified scheduling priority, 0 highest, 7 lowest;-P is the specified process number:

OPTIONS
-c the scheduling class. 1 for real time, 2 for Best-effort, 3 for
Idle.

-N the scheduling class data. This defines the class data, if the
Class accepts an argument. For real time and Best-effort, 0-7 is
Valid data.

-P Pass in a process PID to change an already running process. If
This argument was not given, Ionice would run the listed program
With the given parameters.

Ionice divides the disk IO schedule into three categories:

    • Real time scheduling, immediate access to the disk after Setup, regardless of whether other processes in the system have IO, may cause other processes to wait, can not be used here;
    • Best effort default scheduling, you can specify the scheduling priority (from 0 to 7, the smaller the value, the higher the priority), the same priority process using the Round-robin algorithm scheduling;
    • Idle idle dispatch, disk IO can only be performed if the current system has no other process disk IO.

Well, if too much, we will change the scheduling of this process to idle, this will greatly reduce the IO of this virtual machine, the virtual machine can only maintain the basic available state, not recommended ~

25089 3

Linux uses Ionice to limit Xen virtual machine disk IO

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.