JerryLead / SparkInternals

Notes talking about the design and implementation of Apache Spark

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The quantitative relationship between workers and executors

JerryLead opened this issue · comments

@OopsOutOfMemory 指出关于OverView中如何配置多个Backend进程的问题:在Worker Actor中,每次LaunchExecutor会创建一个Backend进程,它们是1对1的关系。也就是说集群里启动多少Executor实例就有多少Backend进程。

Backend个数发生变化情况:1、启动一个新的Application(每个APP都会 LaunchExecutor,此时会生成此进程)2、还可以通过设置SPARK_WORKER_INSTANCES参数来增加 Backend个数。图可以依此稍做改动。

设置多个Worker只是增加了集群资源,可申请更多的executor起来计算,这样就可以增加CoarseGrainedExecutorBackend。不过这样做似乎没有什么意义。只是想表达“Executor和CoarseGrainedExecutorBackend”是一对一启动的,增加Executor的个数,就是增加CoarseGrainedExecutorBack.

如果想调大1个Worker里的CoarseGrainedExecutorBackend的个数,就要通过参数设置,调节Worker所生成的executor的个数,一般受cpu核数影响。

这里有一个算法,去根据当前ALIVE的Worker还剩余的core,并且当前Worker没有此APP的executor,并且。。。此处省去若干字,具体还是去Master.scala里的schedule方法看一下吧,这个评论字数有限制,没法描述清楚。

刚才说的增加Worker的个数,其实就是增加可用cpu个数,让executor可以产生的更多,被分配到更多的Worker上。如果是yarn模式,可以去研究一下spark-submit 里指定的--num-executors这个参数。。

@JerryLead 我写了一片关于理解Executor的生成策略的文章,移步 http://blog.csdn.net/oopsoom/article/details/38763985