文章目录
- 启动参数
- 增加任务的并行度
- executor-memory
- executor-cores
- num-executors
- partitionNumber
启动参数
nuhup spark-submit --class com.类名绝对路径 --master yarn --deploy-mode cluster --driver-memory 4g --executor-memory 8g --executor-cores jar包 输入参数 >>info.log 2>&1 &
增加任务的并行度
executor-memory
(executor-memory + 1) * num-executor <= 集群中总的内存容量大小
注意: 做乘积的时候,executor-memory 的多加一个 core
executor-cores
executor-cores * num-executors <= 集群中的总的核数容量
一个executor如果只分配了一个核的话,在这个executor中的线程数量统一时刻只能有一个(task),并且是串行
如果executor分配N核,在这个executor中的task都是并行,并行的最大数量就是N
num-executors
申请的总的executor数量,executor的数量最好和分区数量成倍数关系
partitionNumber
spark官网建议我们分区数量最好是机器核数的2-3倍