spark-submit

spark-submit --queue root.queue_name --executor-cores 2 --num-executors 400

num-executors:多少个 Executor 节点来执行

executor-memory

executor-cores:executor CPU 核心数

  • core 同一时间执行一个 task
  • 同一个 executor 中的 core 共享 executor-memory
    • 如果任务占用内存比较多,调小 cores 数,可以使用更多内存

driver-memory

  • collect 算子将 RDD 拉取到 Driver 处理需要避免 OOM

spark.yarn.executor.memoryOverhead executor 额外预留的内存

spark.default.parallelism

  • 每个 stage 默认 task 数量 500-1000
  • 设置该参数为num-executors * executor-cores的2~3倍较为合适

spark.dynamicAllocation.minExecutors 以及 spark.dynamicAllocation.maxExecutors

  • 运行时动态分配 core 数

((2182abe5-07fb-43d0-bfb9-0245f1507b89))

((dc10cfe7-cf86-4356-a483-32f76b84d560))

网络回响

作者

Ryen Xiang

发布于

2026-02-17

更新于

2026-02-17

许可协议


评论