spark参数调整调优

1.1 --num-executors 100
参数解释:任务可以申请的Excutor最大数量,并不是一次性分配100个Excutor;Excutor数量会在任务的运行过程中动态调整,有 job处于pending状态则申请Excutor,一个Excutor空闲时间过长则将其移除;Excutor的数量决定了任务的并行度;

申请Excutor:当有任务处于pending状态(积压)超过一定时间,就认为资源不足,需要申请Excutor;

何时申请:当pending积压的任务超过spark.dynamicAllocation.schedulerBacklogTimeout(1秒)就申请
申请多少:申请数量 = 正在运行和pending的任务数量 * spark.dynamicAllocation.executorAllocationRatio(1)/ 并行度
移除Excutor:

spark.dynamicAllocation.enabled(false)决定是否使用资源动态分配;必须开启外部shuffle;
spark.dynamicAllocation.executorIdleTimeout (60s)空闲60s就会被回收(并且没有缓存);
决定任务的并行度:executor的数量就是工作节点的数量,直接决定了任务的并行度;准确的说是由executor*core决定的;这只是物理上提供的最大并行度,而任务实际的并行度还是由程序中设置的并行度决定,也就是RDD的分区数;

1.2 --executor-memory 5g
参数解释:每个execu

猜你喜欢

转载自blog.csdn.net/weixin_43214644/article/details/125967942