【发布时间】:2014-12-08 12:56:09
【问题描述】:
我正在尝试对 Docker 容器 CPU 使用设置绝对限制。 CPU 共享概念 (docker run -c <shares>) 是相对的,但我想说“让这个容器每 100 毫秒最多使用 20 毫秒的 CPU 时间。我能找到的最接近的答案是 hint from the mailing list 使用 cpu.cfs_quota_us和cpu.cfs_period_us。使用docker run时如何使用这些设置?
我对 LXC 支持的 Docker(例如 pre0.9)或更高版本没有严格要求,只需要查看正在使用的这些设置的示例——任何指向相关文档或有用博客的链接都非常有用同样欢迎。我目前使用的是 Ubuntu 12.04,在 /sys/fs/cgroup/cpu/docker 下我看到了这些选项:
$ ls /sys/fs/cgroup/cpu/docker
cgroup.clone_children cpu.cfs_quota_us cpu.stat
cgroup.event_control cpu.rt_period_us notify_on_release
cgroup.procs cpu.rt_runtime_us tasks
cpu.cfs_period_us cpu.shares
【问题讨论】:
标签: docker cpu-usage scheduler lxc cgroups