zoukankan      html  css  js  c++  java
  • HDP3.1 中 YRAN 和 MR2 的内存大小配置的计算方式

        Container 是 YARN 中基本的处理单元,它是对内存、CPU等计算的封装。总的来说,每个core每块硬盘 分配2个 container,能获得较好的集群利用率。

      1. 确定可用内存大小。

      对于每台主机来说,YARN 和 MapReduce 能用内存大小是除去预留给系统的内存(如果还有 HBase,还要相应留内存给它)后的大小,即:

    YARN 可用内存(RAM for YARN) = 总内存(Total RAM) - 系统预留(Reserved for System) - HBase预留(Reserved for HBase)

    以下是预留内存大小的推荐表

    每台 Node 的总内存 给系统预留的内存 给 HBase 预留的内存
    4 GB 1 GB 1 GB
    8 GB 2 GB 1 GB
    16 GB 2 GB 2 GB
    24 GB 4 GB 4 GB
    48 GB 6 GB 8 GB
    64 GB 8 GB 8 GB
    72 GB 8 GB 8 GB
    96 GB 12 GB 16 GB
    128 GB 24 GB 24 GB
    256 GB 32 GB 32 GB
    512 GB 64 GB 64 GB

    2. 计算每个 Node 最大允许的 container 的数量

    最大container 数量 = min (2*CORES, 1.8*DISKS, (总的可用内存) / MIN_CONTAINER_SIZE)

    上面 CORES 指的是核数,DISKS 是硬盘数, MIN_CONTAINER_SIZE 是 container 最小的内存大小。

    MIN_CONTAINER_SIZE 推荐表:

    每个 Node 总内存 推荐的 Minimum Container Size
    Less than 4 GB 256 MB
    Between 4 GB and 8 GB 512 MB
    Between 8 GB and 24 GB 1024 MB
    Above 24 GB 2048 MB

    3. 计算 RAM-per-Container

    RAM-per-container = max(MIN_CONTAINER_SIZE, (总内存) / containers))

    通过上面计算得到的值,可以按下表进行配置

    配置文件 配置项 数值计算公式
    yarn-site.xml yarn.nodemanager.resource.memory-mb = containers * RAM-per-container
    yarn-site.xml yarn.scheduler.minimum-allocation-mb = RAM-per-container
    yarn-site.xml yarn.scheduler.maximum-allocation-mb = containers * RAM-per-container
    mapred-site.xml mapreduce.map.memory.mb = RAM-per-container
    mapred-site.xml         mapreduce.reduce.memory.mb = 2 * RAM-per-container
    mapred-site.xml mapreduce.map.java.opts = 0.8 * RAM-per-container
    mapred-site.xml mapreduce.reduce.java.opts = 0.8 * 2 * RAM-per-container
    yarn-site.xml (check) yarn.app.mapreduce.am.resource.mb = 2 * RAM-per-container
    yarn-site.xml (check) yarn.app.mapreduce.am.command-opts = 0.8 * 2 * RAM-per-container

    下面以单台节点具有 12 core,48G内存, 12 块硬盘 举例

    (1)预留内存(Reserved RAM) = 6G(系统) + 8G(HBase)

    (2)MIN_CONTAINER_SIZE = 2G

    (3)container_num = min (2*12, 1.8* 12, (48-6-8)/2) = min (24, 21.6, 17) = 17

    (4)RAM-per-container = max (2, (48-6-8)/17) = max (2, 2) = 2

    得出如下配置项的值

    配置项 计算得到的值
    yarn.nodemanager.resource.memory-mb = 17 * 2 = 34*1024 MB
    yarn.scheduler.minimum-allocation-mb = 2*1024 MB
    yarn.scheduler.maximum-allocation-mb = 17 * 2 = 34*1024 MB
    mapreduce.map.memory.mb = 2*1024 MB
    mapreduce.reduce.memory.mb          = 2 * 2 = 4*1024 MB
    mapreduce.map.java.opts = 0.8 * 2 = 1.6*1024 MB
    mapreduce.reduce.java.opts = 0.8 * 2 * 2 = 3.2*1024 MB
    yarn.app.mapreduce.am.resource.mb = 2 * 2 = 4*1024 MB
    yarn.app.mapreduce.am.command-opts = 0.8 * 2 * 2 = 3.2*1024 MB

    注意:

    1. 改变 yarn.scheduler.minimum-allocation-mb 或 yarn.scheduler.minimum-allocation-mb,可以改变单个 Node 中 container 的数量

    2. 如果 Node 具有较高的 RAM,但是较少的 cores 或 disks,可以减少  yarn.scheduler.minimum-allocation-mb 和 yarn.scheduler.minimum-allocation-mb 的值,以释放更多的内存给其它应用。

  • 相关阅读:
    test
    设置section的距离
    UISearchBar的应用
    Centos6.6 系统优化
    Linux系统之间文件传输 scp 命令
    MySQL 数据库安装
    AWS中国EC2 公网IP登录免pemKEY修改shh 配置文件
    Ubuntu 16.04 Chrome浏览器安装flash player插件
    Centos6.6 yum源更新
    qume-kvm 命令管理
  • 原文地址:https://www.cnblogs.com/langfanyun/p/10831594.html
Copyright © 2011-2022 走看看