spark系統實現yarn資源的自動調度


參考:

http://blog.csdn.net/dandykang/article/details/48160953

 

    對於Spark應用來說,資源是影響Spark應用執行效率的一個重要因素。當一個長期運行 的服務(比如Thrift Server),若分配給它多個Executor,可是卻沒有任何任務分配給它,而此時有其他的應用卻資源張,這就造成了很大的資源浪費和資源不合理的調度。 
    動態資源調度就是為了解決這種場景,根據當前應用任務的負載情況,實時的增減 Executor個數,從而實現動態分配資源,使整個Spark系統更加健康。
 
配置步驟:
 
    1. 需要先配置External shuffle service。參見 spark on yarn(External shuffle service)配置
    2. 在“spark-defaults.conf”中必須添加配置項“spark.dynamicAllocation.enabled”,並將該參數的值設置為“true”,表示開啟動態資源調度功能。默認情況下關閉此功能。
    3. 根據情況配置一些可選參數
 
以下是基本配置參考
spark.shuffle.service.enabled                true   配置External shuffle Service服務(一定要配置啟用)
spark.shuffle.service.port                       7337
spark.dynamicAllocation.enabled         true   啟用動態資源調度
spark.dynamicAllocation.minExecutors    3    每個應用中最少executor的個數
spark.dynamicAllocation.maxExecutors    8    每個應用中最多executor的個數
 
 

可選參數說明:

 
配置項                                                                                    說明                                                                默認值
spark.dynamicAllocation.minExecutors                             最小Executor個數。                                        0 
spark.dynamicAllocation.initialExecutors                          初始Executor個數。                                        spark.dynamicAllocation.minExecutors
spark.dynamicAllocation.maxExecutors                             最大executor個數。                                        Integer.MAX_VALUE
spark.dynamicAllocation.schedulerBacklogTimeout         調度第一次超時時間。                                 1(s)
spark.dynamicAllocation.sustainedSchedulerBacklogTimeout 調度第二次及之后超時時間。      spark.dynamicAllocation.schedulerBacklogTimeout
spark.dynamicAllocation.executorIdleTimeout                  普通Executor空閑超時時間。                          60(s)
spark.dynamicAllocation.cachedExecutorIdleTimeout      含有cached blocks的Executor空閑超時時間。spark.dynamicAllocation.executorIdleTimeout的2倍
 
說明
1. 使用動態資源調度功能,必須配置External Shuffle Service。如果沒有使用External Shuffle Service,Executor被殺時會丟失shuffle文件。 
2. 配置了動態資源調度功能,就不能再單獨配置Executor的個數,否則會報錯退出。
3. 使用動態資源調度功能,能保證最少的executor的個數(spark.dynamicAllocation.minExecutors)

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM