
# 提交Spark任务时Driver端提示运行内存超限
#### 问题现象
运行内存超限导致提交Spark任务失败。
#### 原因分析
在Driver日志中直接打印申请的executor memory超过集群限制。
```
... INFO Client: Verifying our application has not requested more than the maximum memory capability of the cluster (6144 MB per container)
... ERROR SparkContext: Error initializing SparkContext.
java.lang.IllegalArgumentException: Required executor memory (10240+1024 MB) is above the max threshold (6144 MB) of this cluster!
```
Spark任务提交至Yarn上面，运行task的executor使用的资源受yarn的管理。从报错信息可看出，用户申请启动executor时，指定10G的内存，超出了Yarn设置的每个container的最大内存的限制，导致任务无法启动。
#### 处理步骤
修改Yarn的配置，提高对container的限制。如可通过调整"yarn.scheduler.maximum-allocation-mb"参数的大小，可控制启动的executor的资源，修改之后要重启Yarn服务。
MRS Manager界面操作：
1. 登录MRS Manager页面。
2. 选择"服务管理 \> Yarn \> 服务配置"将"参数类别"修改为"全部配置"。
3. 在"搜索"栏输入"yarn.scheduler.maximum-allocation-mb"修改参数并保存重启服务。如下图所示： 
   图1修改Yarn服务参数   
   ![](https://support.huaweicloud.com/trouble-mrs/zh-cn_image_0000001802323329.png "点击放大")
   
   
FusionInsight Manager界面操作：
1. 登录FusionInsight Manager页面。
2. 选择"集群 \> 服务 \> Yarn"，单击"配置"，选择"全部配置"。
3. 在"搜索"栏输入"yarn.scheduler.maximum-allocation-mb"修改参数并保存重启服务。
 
