首页 文章

作业使用的执行者的Spark数量

提问于
浏览
0

这是我的火花簇细节 - 内存 - 29.3GB和10核 .

enter image description here

现在我做这份工作,

spark-submit --master spark:// hadoop-master:7077 --executor-memory 1g - executor-cores 2 /home/hduser/ratings-counter.py

但是当我点击完成的应用程序时,我看到有5个执行程序正在执行 .

spark如何确定执行5个执行程序?

enter image description here

2 回答

  • 1

    来自spark配置docs

    spark.executor.cores : The number of cores to use on each executor. In standalone and Mesos coarse-grained modes, setting this parameter allows an application to run multiple executors on the same worker, provided that there are enough cores on that worker. Otherwise, only one executor per application will run on each worker.

    由于您有10个内核并且将executor-cores设置为2,因此它会生成5个执行程序 .

  • 0

    这里解释的问题与微调有关 . 更多信息可在以下网址找到:http://blog.cloudera.com/blog/2015/03/how-to-tune-your-apache-spark-jobs-part-2/

    要设置执行程序的数量,您需要打开YARN . 核心数=执行者可以运行的并发任务(使用hdfs时,建议将其保持在5以下) . 因此,对于您的示例,我们将 --executor-cores 设置为3,而不是像@ user1050619上面的注释中那样设置为2 . 执行者的数量将是10 / 3~3 . 为了确保这一点得到控制,您可以在评论 --num-executors 中使用@ user1050619所述 . 在上面问题的UI中,执行程序的限制是5,所以如果有足够的内存,它将尝试达到此目的 . 解决此问题的一种方法是使用dynamic allocation . 这允许更细粒度的控制 . 这里可以使用选项: spark.dynamicAllocation.maxExecutors 设置最大执行程序的数量,然后也可以将初始执行程序设置为3: spark.dynamicAllocation.initialExecutors .

相关问题