You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.09 23:29:52