What is the difference between `--cpus`, `--cpu-shares` and `--cpuset-cpus`?
BeginnerProductionResource Limits, Health & Reliability
Answer
--cpus=2 is a hard quota (CFS bandwidth: 200ms per 100ms period). --cpu-shares is a relative weight (default 1024) used only under contention, with no cap. --cpuset-cpus=0,1 pins to specific cores, useful for NUMA/latency-sensitive workloads. Shares are the "soft" option, cpus the "hard" one.
More on Resource Limits, Health & Reliability
How do you set memory and CPU limits, and what happens when they are exceeded?BeginnerWhat does `--memory-reservation` do?AdvancedHow do you diagnose an OOM-killed container?IntermediateWhy do JVM and Node services in containers need explicit memory flags?IntermediateWhat is CPU throttling, and how do you detect it?AdvancedHow do you limit PIDs and open files in a container?Beginner