V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
wniming
V2EX  ›  Linux

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

  •  
  •   wniming · Feb 10, 2023 · 2743 views
    This topic created in 1181 days ago, the information mentioned may be changed or developed.

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

    5 replies    2023-02-23 09:17:58 +08:00
    chuckzhou
        1
    chuckzhou  
       Feb 10, 2023
    ~$ 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
       Feb 10, 2023   ❤️ 1
    @chuckzhou 感谢回复,我用的是 lxc ,有没有直接用 cgroup 对进程进行限制的教程?
    OutOfMemoryError
        3
    OutOfMemoryError  
       Feb 10, 2023
    @wniming #2 我没记错的话 docker 现在默认使用 systemd ,但是也支持 cgroups 管理 那应该是支持的
    pagxir
        4
    pagxir  
       Feb 11, 2023
    lxc-cgroup -n armbian blkio.throttle.read_bps_device "230:0 1048576"
    cmingxu
        5
    cmingxu  
       Feb 23, 2023   ❤️ 1
    分 writeback 和 directio ,directio 好说,writeback 比较麻烦
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1081 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 48ms · UTC 18:10 · PVG 02:10 · LAX 11:10 · JFK 14:10
    ♥ Do have faith in what you're doing.