【发布时间】:2019-09-17 09:11:21
【问题描述】:
我有一个在启用了动态资源分配的集群上运行的 spark 作业。我提交了带有 num executors 和 executor 内存属性的 spark 作业。这里优先考虑什么?作业将使用动态分配还是使用我在配置中提到的资源运行?
【问题讨论】:
标签: apache-spark pyspark apache-spark-sql spark-streaming
我有一个在启用了动态资源分配的集群上运行的 spark 作业。我提交了带有 num executors 和 executor 内存属性的 spark 作业。这里优先考虑什么?作业将使用动态分配还是使用我在配置中提到的资源运行?
【问题讨论】:
标签: apache-spark pyspark apache-spark-sql spark-streaming
这取决于哪个配置参数的值更大...
spark.dynamicAllocation.initialExecutors 或 spark.executor.instances aka --num-executors(在运行时通过终端启动时)
如果您在 YARN 上使用 Cloudera,请查看参考文档,并确保根据您的环境查看正确的 CDH 版本。
Apache YARN 文档:
https://spark.apache.org/docs/latest/configuration.html#dynamic-allocation
所以总结一下,如果您使用的是--num-executors,除非您将spark.dynamicAllocation.initialExecutors 设置为更高的值,否则它很可能会覆盖(取消和不使用)动态分配。
【讨论】:
configuration documentation (2.4.4) 提到了spark.dynamicAllocation.initialExecutors:
启用动态分配时要运行的初始执行程序数。 如果设置了
--num-executors(或spark.executor.instances)且大于此值,将作为初始执行者数。
所以对我来说,如果启用了动态分配(即spark.dynamicAllocation.enabled 是true),那么它将被使用,并且执行器的初始数量将简单地为 max(spark.dynamicAllocation.initialExecutors, spark.executor.instances)
【讨论】: