Spark动态分配与executor.instances的关系及配置效果问询
Spark动态分配模式下Executor数量的行为分析
当Spark开启动态分配时,初始启动的Executor数量由以下公式计算:
max( spark.dynamicAllocation.initialExecutors, spark.dynamicAllocation.minExecutors, spark.executor.instances )
针对给定的配置参数:
spark.dynamicAllocation.enabled=true spark.dynamicAllocation.minExecutors=1 spark.executor.instances = 5 spark.dynamicAllocation.maxExecutors=5
结论是:Spark会始终保持5个Executor运行,不会从1个启动再扩展至5个。
具体原因:
- 初始Executor数量取公式中三个参数的最大值,这里
spark.executor.instances=5是三者中的最大值,所以作业启动时直接初始化5个Executor。 - 同时
spark.dynamicAllocation.maxExecutors=5限制了Executor的最大数量,初始数量已经达到上限,后续动态分配机制不会再调整Executor数量,因此整个作业周期内都会维持5个Executor。
内容的提问来源于stack exchange,提问作者Matthew
相关产品推荐
相关产品推荐

