减少执行器核心的数量是否会消耗更少的执行器内存?
Does reducing the number of executor-cores consume less executor-memory?
我的 Spark 作业因 YARN 错误失败 Container killed by YARN for exceeding memory limits 10.0 GB of 10 GB physical memory used
。
直觉上,我将核心数从 5
减少到 1
,作业成功 运行。
我没有增加 executor-memory
因为 10g
是我的 YARN 集群的最大值。
我只是想确认一下我的直觉。减少executor-cores
的数量是否消耗更少executor-memory
?如果是,为什么?
是的,每个执行器使用额外 7% 的 memoryOverhead。
创建此计算时会认为您有两个节点,因此我们在一个节点中有三个执行程序,在另一个节点中有两个执行程序。
Memory per executor in the first node = 10GB/3 = 3,333GB
Counting off heap overhead = 7% of 3,333GB = 0,233GB.
So, your executor-memory should be 3,333GB - 0,233GB = 3,1GB per node
您可以在这里阅读另一个解释:
https://spoddutur.github.io/spark-notes/distribution_of_executors_cores_and_memory_for_spark_application.html
spark.executor.cores = 5, spark.executor.memory=10G
这意味着一个执行者可以运行 5个并行任务。这意味着平均需要 5 tasks.So 有效共享 10 GB - 每个任务将有 2 GB 可用。如果所有任务消耗超过 2 GB,那么整个 JVM 最终将消耗超过 10 GB,因此 YARN 将终止容器。
spark.executor.cores = 1, spark.executor.memory=10G
这意味着执行者只能运行 1 个任务。这意味着 10 GB 完全可用于 1 个任务。因此,如果任务使用超过 2 GB 但少于 10 GB,它将正常工作。你的工作就是这种情况,所以它起作用了。
我的 Spark 作业因 YARN 错误失败 Container killed by YARN for exceeding memory limits 10.0 GB of 10 GB physical memory used
。
直觉上,我将核心数从 5
减少到 1
,作业成功 运行。
我没有增加 executor-memory
因为 10g
是我的 YARN 集群的最大值。
我只是想确认一下我的直觉。减少executor-cores
的数量是否消耗更少executor-memory
?如果是,为什么?
是的,每个执行器使用额外 7% 的 memoryOverhead。
创建此计算时会认为您有两个节点,因此我们在一个节点中有三个执行程序,在另一个节点中有两个执行程序。
Memory per executor in the first node = 10GB/3 = 3,333GB
Counting off heap overhead = 7% of 3,333GB = 0,233GB.
So, your executor-memory should be 3,333GB - 0,233GB = 3,1GB per node
您可以在这里阅读另一个解释: https://spoddutur.github.io/spark-notes/distribution_of_executors_cores_and_memory_for_spark_application.html
spark.executor.cores = 5, spark.executor.memory=10G
这意味着一个执行者可以运行 5个并行任务。这意味着平均需要 5 tasks.So 有效共享 10 GB - 每个任务将有 2 GB 可用。如果所有任务消耗超过 2 GB,那么整个 JVM 最终将消耗超过 10 GB,因此 YARN 将终止容器。
spark.executor.cores = 1, spark.executor.memory=10G
这意味着执行者只能运行 1 个任务。这意味着 10 GB 完全可用于 1 个任务。因此,如果任务使用超过 2 GB 但少于 10 GB,它将正常工作。你的工作就是这种情况,所以它起作用了。