【问题标题】:YARN: maximum parallel Map task countYARN:最大并行 Map 任务数
【发布时间】:2023-03-29 16:35:02
【问题描述】:

Hadoop权威指南中提到了以下内容

"What qualifies as a small job? By default one that has less than 10 mappers, only one reducer, and the input size is less than the size of one HDFS block. "

但是在 YARN 上执行之前,它如何计算作业中的映射器数量? 在 MR1 中,映射器的数量取决于编号。的输入拆分。 YARN 也一样吗? 在 YARN 容器中是灵活的。那么有没有办法计算可以在给定集群上并行运行的最大地图任务数(某种严格的上限,因为它会让我大致了解我可以并行处理多少数据?)?

【问题讨论】:

    标签: hadoop mapreduce hadoop-yarn


    【解决方案1】:

    但是在 YARN 上执行之前,它如何计算作业中的映射器数量?在 MR1 中,映射器的数量取决于编号。的输入拆分。 YARN 也一样吗?

    是的,在 YARN 中,如果您使用基于 MapReduce 的框架,映射器的数量取决于输入拆分。

    在 YARN 中,容器是灵活的。那么有没有办法计算可以在给定集群上并行运行的最大地图任务数(某种严格的上限,因为它会让我大致了解我可以并行处理多少数据?)?

    可以在 YARN 集群上并行运行的 map 任务数量取决于集群上可以启动和并行运行的容器数量。这最终取决于您将如何在集群中配置 MapReduce,这在cloudera 的本指南中进行了清楚的解释。

    【讨论】:

    • 在阅读了您建议的材料后,我已经发布了我的答案。如果发现有问题,请更正或通知。还有一件事,节点上的每个映射器是否共享一个comman heap(mapreduce.[map | reduce].java.opts.max.heap)
    • 是的,集群中的每个映射器或减速器都将具有mapreduce.[map | reduce].java.opts.max.heap 属性指定的堆大小。
    • 那我们为什么不在map任务计算公式中添加它(mapreduce.map.java.opts.max.heap)和mapreduce.map.memory.mb(如上所述)。
    • 因为mapreduce.map.memory.mbmapreduce.map.java.opts.max.heap + 一些头部空间(安全值)的组合。
    【解决方案2】:
    mapreduce.job.maps = MIN(yarn.nodemanager.resource.memory-mb / mapreduce.map.memory.mb,yarn.nodemanager.resource.cpu-vcores / mapreduce.map.cpu.vcores, number of physical drives x workload factor) x number of worker nodes
    

    mapreduce.job.reduces = MIN(yarn.nodemanager.resource.memory-mb / mapreduce.reduce.memory.mb,yarn.nodemanager.resource.cpu-vcores / mapreduce.reduce.cpu.vcores, # of physical drives xworkload factor) x # of worker nodes
    

    对于大多数工作负载,工作负载系数可以设置为 2.0。考虑为 CPU 密集型工作负载设置更高的设置。

    yarn.nodemanager.resource.memory-mb( Available Memory on a node for containers )= Total System memory – Reserved memory( like 10-20% of memory for Linux and its daemon services) -   HDFS Data node ( 1024 MB) – (resources for task buffers, such as the HDFS Sort I/O buffer) – (Memory allocated for DataNode( default 1024 MB), NodeManager, RegionServer etc.)
    

    Hadoop 在设计上是一个以磁盘 I/O 为中心的平台。专用于 DataNode 使用的独立物理驱动器(“主轴”)的数量限制了节点可以维持多少并发处理。因此,分配给 NodeManager 的 vcore 数量应该是以下两者中的较小者:

     [(total vcores) – (number of vcores reserved for non-YARN use)] or  [ 2 x (number of physical disks used for DataNode storage)]
    

    所以

    yarn.nodemanager.resource.cpu-vcores = min{ ((total vcores) – (number of vcores reserved for non-YARN use)),  (2 x (number of physical disks used for DataNode storage))}
    
    Available vcores  on a node for containers = total no. of vcores – for operating system( For calculating vcore demand, consider the number of concurrent processes or tasks each service runs as an initial guide. For OS we take 2 ) – Yarn node Manager( Def. is  1) – HDFS data node( Def. is  1).
    

    注意 ==>

    mapreduce.map.memory.mb is combination of both mapreduce.map.java.opts.max.heap + some head room (safety value)
    

    mapreduce.[map | reduce].java.opts.max.heap 的设置分别指定分配给 mapper 和 reducer 堆大小的默认内存。 mapreduce.[map| reduce].memory.mb 设置指定为其容器分配的内存,并且分配的值应允许超出任务堆大小的开销。 Cloudera 建议对mapreduce.[map | reduce].java.opts.max.heap 设置应用1.2 的系数。最佳值取决于实际任务。 Cloudera 还建议将 mapreduce.map.memory.mb 设置为 1-2 GB,并将 mapreduce.reduce.memory.mb 设置为映射器值的两倍。 ApplicationMaster 堆大小默认为 1 GB,如果您的作业包含许多并发任务,则可以增加。


    参考——

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-16
      • 1970-01-01
      • 2021-10-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多