简体   繁体   English

如何在本地模式下更改执行程序的数量?

[英]How to change number of executors in local mode?

Is it possible to set multiple executors for Spark Streaming application in a local mode using some Spark Conf settings?是否可以使用一些 Spark Conf 设置在本地模式下为 Spark Streaming 应用程序设置多个执行程序? For now, I can not see any changes in Spark UI in terms of performance or executors number increase when I change spark.executor.instances parameter to 4, for example.目前,例如,当我将spark.executor.instances参数更改为 4 时,我看不到 Spark UI 在性能或执行程序数量增加方面的任何变化。

Local mode is a development tool, where all components are simulated in a single machine.本地模式是一种开发工具,所有组件都在一台机器上进行模拟。 Since single JVM mean single executor changing of the number of executors is simply not possible, and spark.executor.instances is not applicable.由于单个 JVM 意味着单个 executor 改变 executor 的数量是不可能的,因此spark.executor.instances不适用。

All you can do in local mode is to increase number of threads by modifying the master URL - local[n] where n is the number of threads.您在local模式下所能做的就是通过修改主 URL 来增加线程数 - local[n]其中n是线程数。

local mode is by definition "pseudo-cluster" that runs in Single JVM.根据定义,本地模式是在单个 JVM 中运行的“伪集群”。 That means maximum number of executors is 1.这意味着最大执行程序数为 1。

If you want to experiment with multiple executors on local machine, what you can do is to create cluster with couple workers running on your local machine.如果你想在本地机器上试验多个 executor,你可以做的是创建集群,在本地机器上运行几个 worker。 Number of running instances is max number of executors for your tasks.正在运行的实例数是您的任务的最大执行程序数。

spark.executor.instances is not honoured in local mode. spark.executor.instances在本地模式下不受尊重。

Reference - https://books.japila.pl/apache-spark-internals/local/?h=local参考 - https://books.japila.pl/apache-spark-internals/local/?h=local

Local-Mode: In this non-distributed single-JVM deployment mode, Spark spawns all the execution components - driver, executor, LocalSchedulerBackend, and master - in the same single JVM.本地模式:在这种非分布式单 JVM 部署模式中,Spark 在同一个 JVM 中生成所有执行组件——驱动程序、执行程序、LocalSchedulerBackend 和主节点。 The default parallelism is the number of threads as specified in the master URL.默认并行度是主 URL 中指定的线程数。 This is the only mode where a driver is used for execution.这是使用驱动程序执行的唯一模式。

So you can increase number of threads in JVM to n by passing master url as local[n] .因此,您可以通过将主 url 作为local[n]传递来将 JVM 中的线程数增加到 n。

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

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