使用cgroup 限制程式的磁碟io
from:http://blog.csdn.net/ylqmf/article/details/43205163
cat /etc/cgconfig.conf
#
# Copyright IBM Corporation. 2007
#
# Authors: Balbir Singh <>
# 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/
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
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26250550/viewspace-1417868/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 使用iostat檢視磁碟IOiOS
- 如何對xtrabackup 備份限制使用IO大小
- 玩轉 Cgroup 系列之二:使用 CPUShares 管理 Cgroup
- ASM磁碟組限制ASM
- 15. 監控磁碟IO使用率
- 記憶體與IO,磁碟IO,網路IO記憶體
- Linux 查詢佔用磁碟IO讀寫很高的程式方法Linux
- 磁碟IO效能監控
- 簡述Linux磁碟IOLinux
- MySQL 磁碟 IO 過高MySql
- 定位磁碟IO佔用命令
- mysql資料庫磁碟io高的排查MySql資料庫
- 檢視伺服器的磁碟io效能伺服器
- containerd中的cgroupAI
- 磁碟IO過高時的處理辦法
- 如何使用 Docker 來限制 CPU、記憶體和 IO等資源?Docker記憶體
- 關於Oracle 10g ASM磁碟大小的限制Oracle 10gASM
- CPU、記憶體、磁碟IO之間的關係記憶體
- 029、限制容器的block IO(2019-01-24 週四)BloC
- linux namespace and cgroupLinuxnamespace
- 玩轉 Cgroup 系列之一: Cgroup 的起源、重要性和基本工作原理
- 玩轉 Cgroup 系列之三:挑戰手動管理 Cgroup
- 使用 implode.io 記錄分享你的程式碼片段
- 使用nice,cpulimit和cgroups限制程式CPU使用率MIT
- 磁碟IO故障導致的SQLServer資料庫無法寫入SQLServer資料庫
- io流-file類的使用
- linux 磁碟使用Linux
- 使用 Proxy 突破網管的限制
- 關於socket.io的使用
- IO的資料集使用案例
- MySQL Index Condition Pushdown(ICP)的使用限制MySqlIndex
- Laravel API 速率限制器的使用LaravelAPI
- mysql中雜湊索引的使用限制MySql索引
- Netweaver工作程式的記憶體限制 VS CloudFoundry應用的記憶體限制記憶體Cloud
- 一篇搞懂容器技術的基石: cgroup
- Day24:IO模組的使用
- Go 中 io 包的使用方法Go
- WSL 回收未使用的磁碟空間
- cgroup、資源池、使用者的關係..涉及到GaussDB(DWS)的資源設定