spark on yarn 資源計算公式

2021-10-02 05:42:41 字數 1397 閱讀 9352

一、spark on yarn 提交任務有兩種模式

1、cluster模式 :

提交命令:

--master yarn \

--deploy-mode client \

--executor-memory 3g \ executor所在容器的記憶體

--executor-cores 2 \ executor所在容器的核數

--num-executors 20 \ 最大分配的excuter數量

driver總記憶體:

ceil(((driver-memory *0.1 >384? driver-memory *0.1:384)+driver-memory)/yarn.scheduler.minimum-allocation-mb)*yarn.scheduler.minimum-allocation-mb

excutor總記憶體:

ceil(((executor-memory *0.1 >384? executor-memory *0.1:384)+executor-memory)/yarn.scheduler.minimum-allocation-mb)*yarn.scheduler.minimum-allocation-mb*(實際啟動的executor個數)

2、client模式 :

executorlauncher程序進行資源分配和executor的啟動

提交命令:

--master yarn \

--deploy-mode client \

--conf spark.yarn.am.memory=1g  \ executorlauncher所在容器的記憶體

--conf spark.yarn.am.cores=3 \ executorlauncher所在容器的核數

--executor-memory 3g \ executor所在容器的記憶體

--executor-cores 2 \ executor所在容器的核數

--num-executors 20 \ 最大分配的excuter數量

driver總記憶體:

ceil(((spark.yarn.am.memory *0.1 >384? spark.yarn.am.memory *0.1:384)+spark.yarn.am.memory)/yarn.scheduler.minimum-allocation-mb)*yarn.scheduler.minimum-allocation-mb

excutor總記憶體:

ceil(((executor-memory *0.1 >384? executor-memory *0.1:384)+executor-memory)/yarn.scheduler.minimum-allocation-mb)*yarn.scheduler.minimum-allocation-mb*(實際啟動的executor個數)

spark on yarn日誌切割

由於spark on yarn的日誌會在stderr裡面一直追加,而且streaming又是長應用,那麼stderr會一直增長。解決辦法就是把stderr按天切割,這樣我們就可以刪除之前的日誌了。1.首先,把集群中的hadoop的log4j檔案 etc hadoop conf log4j.prope...

Spark On Yarn徹底解密

spark on yarn 徹底解密 本期內容 1 hadoop yarn解密 2 spark on yarn 解密 一 hadoop yarn 解析 1 yarn是hadoop推出整個分布式 大資料 集群的資源管理器,負責資源的管理和分配,基於yarn我們可以在同乙個大資料集群上同時執行多個計算框...

spark on yarn架構簡介

spark自從問世以來就收到了廣泛的關注,其熱度一直居高不下。spark的出現,為實時資料的處理帶來了極大的方便,相比hadoop,spark在某些情況下處理資料的速度要快於hadoop,其主要原因有以下兩點 1.spark中間的資料不落地,這是最主要的原因,中間的資料存放在記憶體中,這就極大的減少...