Spark动态分配不起作用

时间:2016-07-20 16:46:08

标签: apache-spark yarn hortonworks-data-platform dynamic-allocation

我想为我提交的应用程序使用spark的动态分配功能,但应用程序无法扩展。

我的群集由 3个节点组成,每个节点都有:

  • 4核
  • 8GB RAM
  • spark:1.6
  • YARN + MapReduce2:2.7

我使用hdp 2.4并设置所有需要的动态分配属性,如下所示(它们是在hdp中预先配置的,但我用docs验证了它们):

  • spark.dynamicAllocation.enabled=true
  • spark.dynamicAllocation.initialExecutors=5 - spark.dynamicAllocation.maxExecutors=10
  • spark.dynamicAllocation.minExecutors=1

  • spark.shuffle.service.enabled=true

  • yarn.nodemanager.aux-services=mapreduce_shuffle,spark_shuffle
  • yarn.nodemanager.aux-services.spark_shuffle.class=org.apache.spark.network.yarn.YarnShuffleService

我使用纱线ResourceManager-UI查找使用过的核心。

当我提交以下PI示例时,只使用3个容器,每个1个核心。有足够的资源来分配,但没有使用更多的资源。

./bin/spark-submit --class org.apache.spark.examples.SparkPi \
--master yarn-cluster \
--deploy-mode cluster \
--driver-memory 512m \
--executor-memory 512m\
lib/spark-examples*.jar 10000

当我测试提交具有定义数量的执行程序的PI示例时,可以分配更多资源。在这个例子中,静态分配8个容器,每个1个核心。 (1名司机+ 7名执行人)

./bin/spark-submit --class org.apache.spark.examples.SparkPi \
--master yarn-cluster \
--num-executors 7 \
--driver-memory 512m \
--executor-memory 512m \
lib/spark-examples*.jar 100000

我错了什么,火花不能自动分配最大可用资源?

谢谢你的帮助:)

2 个答案:

答案 0 :(得分:0)

我认为此博客(http://jerryshao.me/architecture/2015/08/22/spark-dynamic-allocation-investigation/)可以为您提供帮助。 您的申请可以申请多达10名遗嘱执行人,但不需要这么多遗嘱执行人。

答案 1 :(得分:0)

当他想将其运行到动态分配模式时,不应指定--num-executor参数。