简体   繁体   English

Spark Streaming 应用程序使用所有工作线程

[英]Spark Streaming application uses all the workers

I have installed Apache spark on one machine with 3 workers and 2 cores for each worker.我已经在一台机器上安装了 Apache spark,每个工人有 3 个工人和 2 个内核。

Now I have two spark streaming applications.现在我有两个火花流应用程序。 The first is written in Java and the other is written in python.第一个是用Java编写的,另一个是用python编写的。

I need to run the two applications.我需要运行这两个应用程序。

When I submit the first application, it uses all the workers.当我提交第一个申请时,它使用了所有的工人。 When I submit the second application it remains in the WAITING state as there is no available resources to run (as far as I understand).当我提交第二个应用程序时,它仍处于 WAITING 状态,因为没有可用资源可以运行(据我所知)。

Is there a way to allocate only two workers for the first application in order to leave space for the other application?有没有办法只为第一个应用程序分配两个工作人员,以便为另一个应用程序留出空间?

You should set the following configuration property in the spark configuration used to create the sparkContext .您应该在用于创建sparkContext的 spark 配置中设置以下配置属性。

spark.cores.max=<value>

to assign the right number of core for each spark job running.为每个运行的火花作业分配正确数量的核心。 Keep in mind that if you are using the consumer-based streaming model, you need to reserve 1 core for each consumer you declare + additional cores for the spark processing.请记住,如果您使用基于消费者的流模型,则需要为您声明的每个消费者保留 1 个核心 + 用于火花处理的额外核心。

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

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