简体   繁体   English

Spark本地模式下的执行程序数

[英]Number of Executors in Spark Local Mode

So I am running a spark job in local mode. 所以我在本地模式下运行一个火花工作。 I use the following command to run the job 我使用以下命令来运行该作业

spark-submit --master local[*] --driver-memory 256g --class main.scala.mainClass target/scala-2.10/spark_proj-assembly-1.0.jar 0 large.csv 100 outputFolder2 10

I am running this on a machine with 32 Cores and 256GB RAM. 我在一台32核和256GB RAM的机器上运行它。 When creating the conf i use the following code 创建conf时,请使用以下代码

val conf = new SparkConf().setMaster("local[*]").setAppName("My App")

Now I now in local mode, Spark runs everything inside a single JVM, but does that mean it launches only one driver and use it as executor as well. 现在我现在处于本地模式,Spark在一个JVM中运行所有内容,但这是否意味着它只启动一个驱动程序并将其用作执行程序。 In my time line it shows one executor driver added. 在我的时间线中,它显示了一个执行器驱动程序。 And when I go the the Executors page, there is just one executor with 32 cores assigned to it 当我进入Executors页面时,只有一个执行程序,其中分配了32个核心 时间线中添加了一个执行程序

一个执行者有32个核心 Is this the default behavior ? 这是默认行为吗? I was expecting spark would launch one executor per core instead of just one executor that gets all the core. 我期待spark会为每个核心启动一个执行程序,而不是只有一个执行程序才能获得所有核心。 If some one can explain the behavior, that would be great 如果有人可以解释这种行为,那就太好了

Is this the default behavior? 这是默认行为吗?

In local mode, your driver + executors are, as you've said, created inside a single JVM process. 在本地模式下,正如您所说,您的驱动程序+执行程序是在单个JVM进程中创建的。 What you see isn't an executor, it is a view of how many cores your job has at its disposable. 你所看到的不是执行者,而是你的工作在一次性使用的核心数量。 Usually when running under local mode, you should only be seeing the driver in the executors view. 通常在本地模式下运行时,您应该只在执行程序视图中看到驱动程序。

If you look at the code for LocalSchedulerBackend , you'll see the following comment: 如果查看LocalSchedulerBackend的代码,您将看到以下注释:

/**
 * Used when running a local version of Spark where the executor, backend, and master all run in
 * the same JVM. It sits behind a [[TaskSchedulerImpl]] and handles launching tasks on a single
 * Executor (created by the [[LocalSchedulerBackend]]) running locally.

We have a single, in the same JVM instance executor which handles all tasks. 我们在同一个JVM实例中有一个处理所有任务的执行器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM