2017-04-20 86 views
-1

我有emr集群,配置如下。过度利用带有火花的纱线资源

Data Nodes : 6 
RAM per Node : 56 GB 
Cores per Node: 32 
Instance Type: M4*4xLarge 

我在spark-sql下运行,并行执行5个hive脚本。

spark-sql --master yarn --num-executors 1 --executor-memory 20G --executor-cores 20 --driver-memory 4G -f hive1.hql & spark-sql --master yarn --num-executors 1 --executor-memory 20G --executor-cores 20 --driver-memory 4G -f hive2.hql & spark-sql --master yarn --num-executors 1 --executor-memory 20G --executor-cores 20 --driver-memory 4G -f hive3.hql & spark-sql --master yarn --num-executors 1 --executor-memory 20G --executor-cores 20 --driver-memory 4G -f hive4.hql & spark-sql --master yarn --num-executors 1 --executor-memory 20G --executor-cores 20 --driver-memory 4G -f hive5.hql 

但是,270 GB的存储器是由纱线利用。

如在每给定的命令的参数,

每个saprk作业应仅利用120 GB RAM。

1 * 20 + 4 = 24 GB RAM

5作业= 5 * 24 = 120 GB

但是,为什么纱线被利用270 GB RAM? (集群中没有其他hadoop作业正在运行)

我是否需要包含任何额外参数来限制纱线资源利用率?

+0

您是否在使用EMR设置:此集群的maximizeResourceAllocation为true?如果从控制台启动它,它将被默认使用。 –

+0

是的。默认情况下,此群集的动态资源分配为true。将其更改为false可解决我的问题。请查看答案部分以获取更多解释。 –

回答

1

让它在火花defaults.conf为 “spark.dynamicAllocation.enabled” 假(../../spark/spark-xxx/conf/spark-defaults.conf)

这会帮助你限制/避免资源的动态分配。

0

即使我们在命令中设置了执行程序内存,如果资源在群集中可用,spark会动态地分配内存。要将内存使用限制为只执行程序内存,spark动态内存分配参数应设置为false。

您可以直接在spark配置文件中将其更改,或将其作为配置参数传递给该命令。

spark-sql --master yarn --num-executors 1 --executor-memory 20G --executor-cores 20 --driver-memory 4G --conf spark.dynamicAllocation.enabled=false -f hive1.hql 
+1

显然。这是预期的行为,如果它启用。 Spark提供了一种机制,可根据工作负载动态调整应用程序占用的资源。这意味着如果您的应用程序不再使用,并且在有需求时再次请求它们,那么您的应用程序可能会将资源返回给群集。如果多个应用程序共享Spark群集中的资源,此功能特别有用。 –