gpt4 book ai didi

apache-spark - 在 YARN 上启动 Spark 应用程序之前,如何等到所有执行程序都分配完毕?

转载 作者:行者123 更新时间:2023-12-03 15:45:55 27 4
gpt4 key购买 nike

我们在 yarn 集群上运行 Spark 作业,发现即使没有足够的资源, Spark 作业也会启动。

举一个极端的例子,一个 spark 作业需要 1000 个执行器(4 个内核和 20GB 内存)。而在整个集群中,我们只有 r3.xlarge 的 30 个节点。 (4 核和 32GB 内存)。该作业实际上只需 30 个执行程序即可启动和运行。
我们尝试将动态分配设置为 false,并尝试了容量调度程序和 yarn 公平调度程序。一样的。

任何想法如何在没有足够资源的情况下使工作无法开始?是否有任何 Spark 侧或 yarn 侧设置?

最佳答案

我好像刚刚回复了a very similar question .

考虑一个用例,您不想等待所有可用资源,并在数量刚好足以启动任务时立即启动。
这就是 YARN 上的 Spark 有一个额外检查(又名 minRegisteredRatio)的原因,它是在应用程序开始执行任务之前请求的最少 80% 的内核。
由于您希望在 Spark 应用程序启动之前让所有内核都可用,请使用 spark.scheduler.minRegisteredResourcesRatio Spark 属性来控制比例。
报价the official Spark documentation (突出显示我的):

spark.scheduler.minRegisteredResourcesRatio

0.8 for YARN mode

The minimum ratio of registered resources (registered resources / total expected resources) (resources are executors in yarn mode, CPU cores in standalone mode and Mesos coarsed-grained mode ['spark.cores.max' value is total expected resources for Mesos coarse-grained mode] ) to wait for before scheduling begins. Specified as a double between 0.0 and 1.0. Regardless of whether the minimum ratio of resources has been reached, the maximum amount of time it will wait before scheduling begins is controlled by config spark.scheduler.maxRegisteredResourcesWaitingTime.

关于apache-spark - 在 YARN 上启动 Spark 应用程序之前,如何等到所有执行程序都分配完毕?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47926261/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com