V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
wniming
V2EX  ›  Linux

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

  •  
  •   wniming · 2023-02-10 21:28:35 +08:00 · 2187 次点击
    这是一个创建于 448 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    5 条回复    2023-02-23 09:17:58 +08:00
    chuckzhou
        1
    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
        2
    wniming  
    OP
       2023-02-10 21:53:44 +08:00   ❤️ 1
    @chuckzhou 感谢回复,我用的是 lxc ,有没有直接用 cgroup 对进程进行限制的教程?
    OutOfMemoryError
        3
    OutOfMemoryError  
       2023-02-10 22:10:53 +08:00
    @wniming #2 我没记错的话 docker 现在默认使用 systemd ,但是也支持 cgroups 管理 那应该是支持的
    pagxir
        4
    pagxir  
       2023-02-11 00:31:08 +08:00
    lxc-cgroup -n armbian blkio.throttle.read_bps_device "230:0 1048576"
    cmingxu
        5
    cmingxu  
       2023-02-23 09:17:58 +08:00   ❤️ 1
    分 writeback 和 directio ,directio 好说,writeback 比较麻烦
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2380 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 11:30 · PVG 19:30 · LAX 04:30 · JFK 07:30
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.