资源限制
1 CPU 和 内存
body = {
"Memory": int(self.container["flavor"]["memoryInMB"]["limit"]) * 1024 * 1024,
"MemorySwap": int(self.container["flavor"]["memoryInMB"]["limit"]) * 1024 * 1024,
"CpuShares": int(self.container["flavor"]["cpuInCore"]["quota"]) * 1024,
"CpuQuota": int(self.container["flavor"]["cpuInCore"]["limit"]) * 100000
}docker update --help
Usage: docker update [OPTIONS] CONTAINER [CONTAINER...]
Update configuration of one or more containers
Options:
--blkio-weight uint16 Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)
--cpu-period int Limit CPU CFS (Completely Fair Scheduler) period
--cpu-quota int Limit CPU CFS (Completely Fair Scheduler) quota
--cpu-rt-period int Limit the CPU real-time period in microseconds
--cpu-rt-runtime int Limit the CPU real-time runtime in microseconds
-c, --cpu-shares int CPU shares (relative weight)
--cpus decimal Number of CPUs
--cpuset-cpus string CPUs in which to allow execution (0-3, 0,1)
--cpuset-mems string MEMs in which to allow execution (0-3, 0,1)
--kernel-memory bytes Kernel memory limit
-m, --memory bytes Memory limit
--memory-reservation bytes Memory soft limit
--memory-swap bytes Swap limit equal to memory plus swap: '-1' to enable unlimited swap
--pids-limit int Tune container pids limit (set -1 for unlimited)
--restart string Restart policy to apply when a container exits1.1 CPU
2 磁盘限速
2.1 Direct I/O 和 Buffered I/O
2.2 Cgroup v1 Vs v2
2.2.1 /sys/fs/cgroup/
2.3 系统开启 Cgroup v2
2.4 Docker 配置
2.5 测试
2.5.1 创建容器
2.5.2 dd 测试
2.5.3 查看磁盘 io
2.5.4 磁盘 io 限制
2.6 Docker API 限制磁盘 IO
2.7 示例
2.8 对运行中的容器进行限制磁盘 IO
2.9 获取磁盘编号
Last updated