使用cgroup 限制进程的磁盘io
来源:互联网 发布:卡密社区系统源码 编辑:程序博客网 时间:2024/05/19 03:22
cat /etc/cgconfig.conf
#
# Copyright IBM Corporation. 2007
#
# Authors: Balbir Singh <balbir@linux.vnet.ibm.com>
# This program is free software; you can redistribute it and/or modify it
# under the terms of version 2.1 of the GNU Lesser General Public License
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it would be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See man cgconfig.conf for further details.
#
# By default, mount all controllers to /cgroup/<controller>
mount {
cpuset = /cgroup/cpuset;
cpu = /cgroup/cpu;
cpuacct = /cgroup/cpuacct;
memory = /cgroup/memory;
devices = /cgroup/devices;
freezer = /cgroup/freezer;
net_cls = /cgroup/net_cls;
blkio = /cgroup/blkio;
}
group shard_0{
blkio{
blkio.throttle.read_iops_device="253:3 16000";
blkio.throttle.write_iops_device="253:3 16000";
blkio.weight="500";
}
}
group shard_1{
blkio{
blkio.throttle.read_iops_device="253:3 16000";
blkio.throttle.write_iops_device="253:3 16000";
blkio.weight="500";
}
}
blkio.throttle.read_iops_device 读iops
blkio.throttle.write_iops_device 写iops
253:3是设备的编号
比如我们要限制进程在flashcache上的iops
[root@test ~]# ls -l /dev/mapper/cachedev
lrwxrwxrwx 1 root root 7 Jan 25 21:16 /dev/mapper/cachedev -> ../dm-3
这里看到只是一个软连接,我们接着找
[root@test~]# ls -l /dev/dm-3
brw-rw---- 1 root disk 253, 3 Jan 25 21:16 /dev/dm-3
因此我们限制某个进程在 flashcache上的iops最高16000就 写成 253:3 16000
启动cgroup
[root@c3-b2c-dba-backend-mysql09 /]# service cgconfig restart
Stopping cgconfig service: [ OK ]
Starting cgconfig service: [ OK ]
然后就可以将进程id写进cgroup 对应的task了
[root@test shard_0]# pwd
/cgroup/blkio/shard_0
[root@test shard_0]# cat tasks
48554
339938
340404
340414
340487
340498
340547
340560
340568
340581
340587
340602
340608
340609
340624
340633
340650
340657
340659
340660
340669
340672
340675
340685
340687
340689
340690
340701
340708
340709
340710
340711
340712
340719
341151
341157
341158
341159
341160
341162
341171
341172
341178
341180
341186
341187
341192
341204
341212
341229
341231
341237
341245
341248
341249
341250
341251
341252
341253
341254
341255
341256
341257
341258
341259
341260
341261
341262
341263
341264
341265
341270
341273
341279
341284
341285
341286
341288
341294
341295
341296
341297
341298
341299
341300
341301
341307
341308
- 使用cgroup 限制进程的磁盘io
- 使用CGROUP限制mongd的disk io
- 使用cgroup的blkio子系统自动限制磁盘
- cgroup实践---使用cgroup限制mongodb进程内存
- cgroup限制进程内存大小
- 使用cgroup限制内存
- 使用cgroup限制内存使用
- 使用cgroup限制java使用的内存量-思路
- Linux 下使用 cgroup 控制进程的cpu,内存
- IO-2、磁盘的使用
- cgroup的使用
- RH442 - 通过cgroup来限制kvm虚拟机只使用host的某个cpu和内存大小
- RH442 - 通过cgroup来限制kvm虚拟机只使用host的某个cpu和内存大小
- 限制进程使用的资源
- Cgroup - Linux 的 IO 资源隔离
- cgroups管理进程磁盘io
- IT--cgroup--cgroup使用
- CentOS针对磁盘IO[jdb2进程]的优化
- Jocky for Eclipse
- 啊哈C——学习3.2一起来找茬
- 一些算法题
- Go语言实现跳表(SkipList)
- C++强大背后
- 使用cgroup 限制进程的磁盘io
- 20150127
- 图解JAVA——接口与多态调用
- 三种常用算法概述——遍试、迭代、递归
- android:TableLayout表格布局详解
- 乔布斯经典名言
- Decode Ways|leetcode题解
- 系统安装过程
- 【iOS开发-111】自定义大头针Annotation以及2种导航划线的方法介绍