Spark報Total size of serialized results of 12189 tasks is bigger than spark.driver.maxResultSize

一.異常信息

Total size of serialized results of 12189 tasks is bigger than spark.driver.maxResultSize 1024M.
Total size of serialized results of 12082 tasks is bigger than spark.driver.maxResultSize 1024M.
Total size of serialized results of 12131 tasks is bigger than spark.driver.maxResultSize 1024M.
...

二.原因分析及解決方案

spark默認的maxResultSize爲1024M【也就是1G】,當執行action行爲時,結果數據會彙總到主節點【driver節點】,當數據量很大【或數據傾斜】且沒有進行合理重分區時,就有可能出現這種情況。解決方案:

  1. 調整執行邏輯,避免彙總到主節點的數據過多。
  2. 重新分區,調用repartition(nums),參考數據的規模。
  3. 調大maxResultSize大小爲2G。

調大maxResultSize方式:

  1. 在程序中增加配置:.config("spark.driver.maxResultSize", "2G")
  2. 提交命令增加參數:--conf spark.driver.maxResultSize=2048M
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章