"yarn.scheduler.minimum-allocation-vcores" 和 yarn.scheduler.maximum-allocation-vcores" 在决定 containers/node 的数量中的作用?

The role of "yarn.scheduler.minimum-allocation-vcores" and yarn.scheduler.maximum-allocation-vcores" in deciding the no. of containers/node?

我实际上是想弄清楚单个节点管理器中有多少个容器。它取决于哪些因素? "yarn.scheduler.minimum-allocation-vcores" 和 "yarn.scheduler.maximum-allocation-vcores" 在决定​​每个节点的容器数量中的作用是什么?

yarn 中的默认资源调度程序是 Capacity Scheduler

Capacity Scheduler 有两个资源计算器

  1. DefaultResourceCalculator(默认)

  2. DominantResourceCalculator

DefaultResourceCalculator 仅使用内存来计算可用容器

public int computeAvailableContainers(Resource available, Resource required) {
// Only consider memory
return available.getMemory() / required.getMemory();
  }

DominantResourceCalculator 同时使用内存和内核

  public int computeAvailableContainers(Resource available, Resource required) {
    return Math.min(
        available.getMemory() / required.getMemory(), 
        available.getVirtualCores() / required.getVirtualCores());
  }

yarn.scheduler.minimum-allocation-vcoresyarn.scheduler.maximum-allocation-vcores 在决定​​每个节点的容器数方面没有任何直接作用。

在请求资源时,应用程序告诉 yarn 内存和内核它需要每个容器

在 mapreduce 中,我们指定 mapreduce.map.cpu.vcoresmapreduce.reduce.cpu.vcores

所需的 vcore

在 spark 中,我们指定 spark.executor.cores

所需的 vcores

yarn.scheduler.minimum-allocation-vcoresyarn.scheduler.maximum-allocation-vcores 用于定义每个容器可以分配的最小和最大 vcore 数。