为什么Mesos报告更多的分配CPU比实际核心?

enyaitl3  于 2021-06-26  发布在  Mesos
关注(0)|答案(1)|浏览(316)

我正在使用一些有32个内核的服务器(包括超线程)。但是,当我查看节点框架的详细信息时,我看到有几个报告了超过32个分配的cpu。为什么?
编辑1:
查看其中一个节点,/proc/cpuinfo列出了正确的cpu数量。在这个节点上注册的唯一框架是marathon,这就是我看到cpu过度分配的地方(通过mesos ui)。mesos报告我有32个CPU。

bgtovc5b

bgtovc5b1#

正如代码注解所说,有可能比系统实际分配更多的CPU。框架接受需要适应资源约束的提议,但随后从机为执行者添加一些非零资源。所以同样的情况也会发生在mem身上。

// Default cpu resource given to a command executor.
constexpr double DEFAULT_EXECUTOR_CPUS = 0.1;
// Default memory resource given to a command executor.
constexpr Bytes DEFAULT_EXECUTOR_MEM = Megabytes(32);
...
// Add an allowance for the command executor. This does lead to a
// small overcommit of resources.
// TODO(vinod): If a task is using revocable resources, mark the
// corresponding executor resource (e.g., cpus) to be also
// revocable. Currently, it is OK because the containerizer is
// given task + executor resources on task launch resulting in
// the container being correctly marked as revocable.
executor.mutable_resources()->MergeFrom(
    Resources::parse(
      "cpus:" + stringify(DEFAULT_EXECUTOR_CPUS) + ";" +
      "mem:" + stringify(DEFAULT_EXECUTOR_MEM.megabytes())).get());

webui显示从 master/metrics 端点和值是从执行器计算出来的,而不仅仅是任务。

相关问题