使用cgroup 限制进程的磁盘io

2023-05-16

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

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用cgroup 限制进程的磁盘io 的相关文章

  • C++中回调函数的一个简单例子?

    回调函数应用实例 xff1a 1 定义一个Person类 xff08 Person h xff09 文件 xff1a 注意 xff1a 在这个类中指定了回调函数 xff0c 回调函数的执行者 xff0c 和回调函数指针 重要的是 回调函数
  • Docker容器的端口映射

    在Docker容器的日常使用中 xff0c 有以下5种常见的端口映射方式 1 对容器暴露的所有端口 xff0c 随机映射宿主机端口 P xff0c publish all 61 true false xff0c 默认为false span
  • wsl不动了,wsl2不动了。不响应

    原来是用vim编辑时 xff0c 习惯了 xff0c 按了ctrl 43 s的原因 Ctrl 43 s 在终端下是有特殊用途的 xff0c 那就是暂停该终端 xff0c Ctrl 43 q 退出这种状态 xff0c 让终端继续运行
  • Ubuntu Server 20.04最小部署openstack Wallaby(四)——Nova

    Compute服务与其他OpenStack服务协作 xff0c 协调各种工作 xff0c 是OpenStack的核心服务 xff0c 这里需要操作Controller和Compute两个节点 1 Controller节点配置 创建数据库 注
  • debian8 安装&配置 zsh

    请访问我的个人博客 sourcod 安装zshsudo apt get install zsh安装oh my zsh sh c 34 curl fsSL https raw githubusercontent com robbyrussel
  • Conda错误:Collecting package metadata (current_repodata.json): failed

    conda新安装设置清华源后发现并没有使用 xff0c 且会出现错误 Collecting package metadata current repodata json failed 换了科大源也没成功 xff0c 考虑可能是默认源的问题
  • OpenCascade与三角剖分 笔记

    笔记 摘自 http www cppblog com eryar archive 2013 05 26 200605 html 概述 三角剖分是平面剖分中的一个重要课题 xff0c 在数字图像处理 计算机三维曲面造型 有限元计算 逆向工程等
  • 利用DbgHelp获取导出函数信息

    include 34 stdafx h 34 include lt Windows h gt include lt imagehlp h gt include lt locale h gt pragma comment lib 34 Dbg
  • 《iOS之导航控制器的使用图解》

    通过代码的方式实现 xff1a 导航控制器 导航栏 xff08 height64 xff0c status状态20 xff0c 导航部分44 xff09 内容部分 导航控制器栈 xff1a 通过storyboard方式实现页面导航 设置默认
  • 【Ubuntu笔记】ubuntu18.04设置开机启动命令/脚本的三种方法(可sudo)

    转自微信 谭狗星 很多时候想开机时便启动想要启动的命令 xff08 甚至是需要sudo的命令 xff09 但是如何设置呢 xff0c 一般来说有以下三种方法 xff08 本文针对的是ubuntu18 04设置开机启动命令或者脚本 xff09
  • Pyperclip模块详解

    一 Pyperclip模块安装 Pyperclip模块兼容python2和python3 xff0c 能跨平台使用 安装指令如下 xff0c 在Anaconda的终端执行如下指令 pip install pyperclip 二 Pyperc

随机推荐

  • 如何在Ubuntu 18.04上安装Docker

    选项1 xff1a 使用默认存储库在Ubuntu上安装Docker 第1步 xff1a 更新软件存储库 更新本地软件数据库以确保可以访问最新版本 打开终端并输入 xff1a sudo apt get update 第2步 xff1a 卸载旧
  • iOS创建自己的pod库

    一 背景 在iOS开发中 xff0c 我们经常会使用到一些第三方库 xff0c 如AFNetworking SDWebImage等 xff0c 一般使用cocoapods来管理 本篇文章将介绍如何封装自己的pod库 二 封装步骤 1 在本地
  • Mac OS系统磁盘空间不断减少,直到为0

    问题描述 xff08 从网络摘录 xff09 xff1a 昨天上午Mac OS系统突然警告硬盘空间不足 xff0c 建议删除多余文件 经过清理后硬盘出现20G自由空间 xff0c 但今天系统再次警告硬盘空间不足 只好再次删除一些文件 xff
  • Git,Github和Gitlab简介和使用方法

    日期 xff1a 2016 08 04 来源 xff1a 简书 作者 xff1a frogoscar 字体 xff1a 大 中 小 来源 xff1a https www jianshu com p 8d497989f704 这年头不知道Gi
  • Ubuntu设置清华源

    为了在Ubuntu下安装软件快些 xff0c 需要使用国内的源 xff0c 比如清华源 步骤如下 xff1a 一 xff1a 备份源文件 cd etc apt 然后会显示下面的源文件sources list 输入命令行 xff1a cp为c
  • Git 中忽略某些文件或者文件夹

    Git 中忽略某些文件或者文件夹 有些时候 xff0c 你必须把某些文件放到Git工作目录中 xff0c 但又不能提交它们 xff0c 比如保存了数据库密码的配置文件啦 xff0c 等等 xff0c 每次git status都会显示 Unt
  • 教程:简单十步,在 iTunes 申请 App Store 退款

    你常在 App Store 买应用或音乐吗 xff1f 你肯定有因为买到坑爹的应用而心情糟糕 懊悔不已吧 xff1f 在这种情况下 xff0c 可能有一部分同学知道能向苹果提交退款申请 xff0c 但相信仍有很大一部分同学并不知道还有此等
  • Mac 终于有显示隐藏文件的快捷键了

    转载至 xff1a https hran me archives shortcuts to show hiden files in macos sierra html 在 macOS Sierra 之前 xff0c 要在 Finder 中查
  • UISearchBar的占位符 (Placeholder,包括图片文字) 如何居左显示 ?

    转载至 xff1a https blog csdn net qq 33226881 article details 76512656 UISearchBar的占位符 Placeholder 如何居左显示 xff1f 做项目的时候遇到这个问题
  • C语言冒泡排序

    1 基本原理 冒泡排序指的是在排序时 xff0c 每次比较数组中相邻的两个数组元素的值 xff0c 较小的数 xff08 从小到大排列 xff09 排在较大的数前面 排序的基本思想 两两相邻的元素进行比较 xff0c 并且可能的话需要进行交
  • dell optiplex ubuntu 14.04 安装 NVIDIA 显卡驱动

    公司配置的 dell optiplex使用核显带起双屏幕 xff0c 玩dota2无法特效全开 so xff0c 在京东上买了一块750Ti 安装驱动的时候需要切换到ubuntu的全命令行模式 xff0c 关掉桌面系统才能安装 这时候这个坑
  • golang tcp 2 unix socket proxy

    想将mysql 的TCP 封死 xff0c 所有外部链接由我的proxy来控制 xff0c so 写了一个 tcp 转 unix socket 的 proxy package main import 34 os 34 34 fmt 34 3
  • backup mysql for xtrabackup with xbstream and lz4

    需要临时为mysql添加一个实例 xff0c 使用xtrabackup最简单快速 在现有数据节点上 xff1a home work app xtrabackup 2 2 3 innobackupex ibbackup 61 home wor
  • MySQL分组排序取前N条记录以及生成自动数字序列--group by 后 limit 外加 rownumber

    同事提了一个需求 xff0c 要求按照某列分组 xff0c 然后将各组的前几条抽取出来 表结构 CREATE TABLE 96 total freq ctrl 96 96 time 96 int 10 unsigned NOT NULL 9
  • docker init 起步

    yum install wget http fedora mirror nexicom net epel 6 x86 64 epel release 6 8 noarch rpm yum y install epel release 6 8
  • 设置xrdp使用固定的会话

    修改xrdp ini配置文件 xff0c 位于 etc xrdp xrdp ini 要打开和编辑xrdp的配置文件 xff0c 请使用 xff1a sudo nano etc xrdp xrdp ini 默认情况下 xff0c 第一个xrd
  • 回想当年 91d2 1588 神戒

    渡鳥之箍 全JP属性 xff0c 1588成交
  • mysql 事务 rollback 失效

    最近支付业务发生了一件怪事 xff0c 在一个事务 失败后 xff0c 调用rollback xff0c 发现只rollback 了最后一条sql 开发查了很久 xff0c 发现是网络抖动 xff0c 造成第一次创建链接的 begin 丢掉
  • 旅游

    每次出游 我们自己看来 别人看来 实际上
  • 使用cgroup 限制进程的磁盘io

    cat etc cgconfig conf Copyright IBM Corporation 2007 Authors Balbir Singh lt balbir 64 linux vnet ibm com gt This progra