Yarn 上的动态调度 spark 作业
Dynamic scheduling spark job on Yarn
我在 Yarn 上 运行 spark,但我的应用程序在尝试加载大型 RDD 时不断出现内存不足异常,即使我将动态调度设置为 true
...
.set("spark.shuffle.service.enabled", "true")
.set("spark.dynamicAllocation.enabled", "true")
.set("spark.default.parallelism", String.valueOf(cpu * 3))
要解决这个问题,我必须指定执行程序内存
...
.set("spark.driver.memory", "5g")
.set("spark.executor.memory", "30g")
.set("spark.shuffle.service.enabled", "true")
.set("spark.dynamicAllocation.enabled", "true")
.set("spark.default.parallelism", String.valueOf(cpu * 3))
```
但是动态调度的重点不就是从 Yarn 分配所需的资源吗?
来自documentation on YARN dynamic resource allocation:
In Spark, dynamic resource allocation is performed on the granularity of the executor
这意味着它会启动更多的执行器,但这并不意味着它会改变单个执行器拥有的内存量。如果您向内存中加载的资源超过单个执行程序可以处理的资源,那么启动更多资源将没有任何好处。
我在 Yarn 上 运行 spark,但我的应用程序在尝试加载大型 RDD 时不断出现内存不足异常,即使我将动态调度设置为 true
...
.set("spark.shuffle.service.enabled", "true")
.set("spark.dynamicAllocation.enabled", "true")
.set("spark.default.parallelism", String.valueOf(cpu * 3))
要解决这个问题,我必须指定执行程序内存
...
.set("spark.driver.memory", "5g")
.set("spark.executor.memory", "30g")
.set("spark.shuffle.service.enabled", "true")
.set("spark.dynamicAllocation.enabled", "true")
.set("spark.default.parallelism", String.valueOf(cpu * 3))
```
但是动态调度的重点不就是从 Yarn 分配所需的资源吗?
来自documentation on YARN dynamic resource allocation:
In Spark, dynamic resource allocation is performed on the granularity of the executor
这意味着它会启动更多的执行器,但这并不意味着它会改变单个执行器拥有的内存量。如果您向内存中加载的资源超过单个执行程序可以处理的资源,那么启动更多资源将没有任何好处。