【发布时间】:2019-06-24 17:24:11
【问题描述】:
Kubernetes 允许限制 pod 资源的使用。
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 200m # which is 20% of 1 core
memory: 256Mi
假设我的 kubernetes 节点有 2 个核心。我在这个节点上以 CPU 限制运行这个 pod:200m。在这种情况下,我的 pod 会使用它的底层节点的 1Core 的 200m 还是 2Core 的 100m+100m?
我的gunicorn worker's number formula 或 nginx 工作人员的编号等需要此计算。 在 gunicorn 文档中它说
通常我们建议 (2 x $num_cores) + 1 作为工人数量 开始吧。
那么我应该使用 5 个工人吗? (我的节点有 2 个核心)。或者我的 pod 只分配了 200m cpu 并且我应该考虑我的 pod 有 1 个核心,这甚至都没有关系?
TLDR: 当 pod 的 cpu 使用受到 kubernetes 限制时,pod 使用多少个内核?如果我在 pod 内运行 top,我会看到 2 个内核可用。但我不确定我的应用程序使用的是 2 核的 10%+10% 还是 1 核的 20%..
【问题讨论】:
标签: kubernetes gunicorn google-kubernetes-engine