Linux 内核能不能通过 cgroup 之类的技术限制容器访问 nvme 设备的性能?

2023-02-10 21:28:35 +08:00
 wniming

比如我的服务器上运行 4 个容器,限制每个容器只能使用到 nvme 设备 25%的性能,即便其他容器没有在使用时也是如此。

2225 次点击
所在节点    Linux
5 条回复
chuckzhou
2023-02-10 21:46:35 +08:00
~$ docker help run | grep -E 'bps|IO'
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
--blkio-weight Block IO (relative weight), between 10 and 1000
--blkio-weight-device=[] Block IO weight (relative device weight)
--device-read-bps=[] Limit read rate (bytes per second) from a device
--device-read-iops=[] Limit read rate (IO per second) from a device
--device-write-bps=[] Limit write rate (bytes per second) to a device
--device-write-iops=[] Limit write rate (IO per second) to a device
wniming
2023-02-10 21:53:44 +08:00
@chuckzhou 感谢回复,我用的是 lxc ,有没有直接用 cgroup 对进程进行限制的教程?
OutOfMemoryError
2023-02-10 22:10:53 +08:00
@wniming #2 我没记错的话 docker 现在默认使用 systemd ,但是也支持 cgroups 管理 那应该是支持的
pagxir
2023-02-11 00:31:08 +08:00
lxc-cgroup -n armbian blkio.throttle.read_bps_device "230:0 1048576"
cmingxu
2023-02-23 09:17:58 +08:00
分 writeback 和 directio ,directio 好说,writeback 比较麻烦

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/915031

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX