さかもとのブログ

つらつらと

CDH5でのyarnのリソース設定のパラメータ

今更yarnで?ですが、今導入しようしていて、そのメモ。

基本的にはTuning YARNの項目だけなんだけど、yarnになってから細かく設定出来るかわりに複雑だねー、というところ。 URLにシートがあって、そこにスペックとかを入れると、関係するパラメータの数字を出してくれる。 出してくれるがしかし、入れようにも項目の中身がわからない。ということで、書きだした。

NMとして作用するパラメータ

  • yarn.nodemanager.resource.cpu-vcores

    • Number of CPU cores that can be allocated for containers.
    • NM単体で利用可能なvcoreの値
    • clouderaのシートでは、(OS用などを差し引いたcore数 * Physical Cores to Vcores Multiplier) になっている
  • yarn.nodemanager.resource.memory-mb

    • Amount of physical memory, in MB, that can be allocated for containers.
    • NM単体で利用可能なmemoryの値
    • clouderaのシートでは、物理メモリからOS用などを差し引いた値になっている

containerで有効なパラメータ

  • yarn.scheduler.minimum-allocation-vcores

    • The minimum allocation for every container request at the RM, in terms of virtual CPU cores. Requests lower than this won't take effect, and the specified value will get allocated the minimum.
    • コンテナがRMに要求するvcoreの最小値
  • yarn.scheduler.maximum-allocation-vcores

    • The maximum allocation for every container request at the RM, in terms of virtual CPU cores. Requests higher than this won't take effect, and will get capped to this value.
    • コンテナがRMに要求できるvcoreの最大値。この値でキャップがかけられる。
  • yarn.scheduler.increment-allocation-vcores

    • Vcore allocations must be a multiple of this value
    • この単位でvcoresの要求がインクリメントされる
    • cloudera only
  • yarn.scheduler.minimum-allocation-mb

    • The minimum allocation for every container request at the RM, in MBs. Memory requests lower than this won't take effect, and the specified value will get allocated at minimum.
    • コンテナのメモリ最小値
  • yarn.scheduler.maximum-allocation-mb

    • The maximum allocation for every container request at the RM, in MBs. Memory requests higher than this won't take effect, and will get capped to this value.
    • コンテナがRMに要求できる最大のメモリ。この値でキャップがかかる。
  • yarn.scheduler.increment-allocation-mb

    • Memory allocations must be a multiple of this value
    • この単位でmemoryの要求がインクリメントされる
    • cloudera only

MapReduce

mapred-default.xmlに記載される。

  • yarn.app.mapreduce.am.resource.cpu-vcores

    • The number of virtual CPU cores the MR AppMaster needs.
    • MRのAppMasterに設定されるvcores
  • mapreduce.map.cpu.vcores

    • 1つのmapタスクで利用するvcoreの値
    • これはそのままなので、わかる
  • mapreduce.reduce.cpu.vcores

    • 1つのreduceタスクで利用するvcoreの値
    • これもそのままなので、わかる
  • yarn.app.mapreduce.am.resource.mb

    • The amount of memory the MR AppMaster needs.
    • MRのAppMasterが使用するメモリ
  • mapreduce.map.memory.mb, mapreduce.reduce.memory.mb

    • map, reduceでそれぞれ利用するメモリ
  • mapreduce.map.java.opts.max.heap, mapreduce.reduce.java.opts

    • cloudera only
    • map, reduceの際のjavaのheap size
    • mapとreduce自体に設定したmemoryとは別なの?
  • mapreduce.task.io.sort.mb

    • The total amount of buffer memory to use while sorting files, in megabytes. By default, gives each merge stream 1MB, which should minimize seeks.
    • sortフェーズで利用するメモリ

シートで不明なパラメータ

  • Physical Cores to Vcores Multiplier

この係数を、OSで使う分などで差し引いたものにかけることになっているが、そもそもなんでそんな考えなのかがいまいちわからない。 シートの説明欄には

Set this ratio based on the expected number of concurrent threads per core. Use 1 for CPU intensive tasks up to 4 for standard I/O bound tasks.

とある。I/Oで使っちゃうんだから、下駄を履かせなさいよ、的な感じ。

これをもとにyarn.nodemanager.resource.cpu-vcoresが求められるのだが、Apache Hadoopのページには"Number of CPU cores that can be allocated for containers."とある。 HPのHDPには

For configuring YARN, update the default values of the following attributes with ones that reflect the cores and memory available on a worker node.

とあるので、実コア数を超えない気がするが。うーん。