4 ms·
> "Don't use Docker's --cpu flag and instead use" This is rather strong language without any real qualifiers. It is definitely not "mostly useless". Shares and
by cpuguy83 3y ago
> "Don't use Docker's --cpu flag and instead use"
This is rather strong language without any real qualifiers. It is definitely not "mostly useless".
Shares and quotas are for different use-cases, that's all.
Understand your use-case and choose accordingly.
- dilyevsky 3y agoIt doesn’t make any sense to me why —cpu flag is tweaking quota and not shares since quota is useful in tiny minority of usecases. A lot of people waste a ton of time debugging weird latency issues as a result of this decision
- the8472 3y agoWith shares you're going to experience worse latency if all the containers on the system size their thread pool to the maximum that's available during idle periods and then constantly context-switch due to oversubscription under load. With quotas you can do fixed resource allocation and the runtimes (not Go apparently) can fit themselves into that and not try to service more requests than they can currently execute given those resources.
- dilyevsky 3y agoAnd how is that different from worse latency due to cpu throttling from your users’ perspective?
- the8472 3y agoFixed queue, so it'll only take as many as it can process and reject the rest, which can be used to do scaling, if you have a cluster. With shares it would think it has all the CPU cores available and oversize the queue.
- dilyevsky 3y agoDoesn’t answer my q really. At least in kubernetes scaling is done by measuring usage against the request (shares) not the limit (quota)
- eightnoteight 3y agothis is a predictable worse latency due to CPU throttling, i.e nothing is suddenly introduced in the system. but the other case is worse i.e a non critical microservice can cause outage on your critical microservice. imagine some non critical system like blog-service suddenly causing 2-3% new order creation failures
- cpuguy83 3y agoThese two options are not mutually exclusive. When you want to limit the max CPU time available to a container use quotas (--cpus). When you want to set relative priorities (compared to other containers/processes), use shares. These two options can be combined, it all depends on what you need.