微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Spark YARN 客户端模式1 个主站,4 个从站:无法更改驱动程序内存 master 的日志文件显示 -Xmx1g

如何解决Spark YARN 客户端模式1 个主站,4 个从站:无法更改驱动程序内存 master 的日志文件显示 -Xmx1g

我在带有 的 ec2 集群 上使用 spark-2.4.7-without-hadoophadoop-3.2.2配置

Master(一个 ec2 c4.2xlarge)具有 16GB RAM 和 8vcpu(4 个物理内核和超线程因子 2); 4 个从站(每个从站是一个 ec2 m4.xlarge),每个有 15GB RAM 和 4vcpu(4 个物理内核)。

我使用 spark-submit 提交了一个应用程序 jar,以在客户端模式下在 YARN 集群上运行。我在主机上触发 spark-submit 如下:

${SPARK_HOME}/bin/spark-submit --master yarn --deploy-mode client --driver-memory 12g --executor-memory 12g --executor-cores 3 --class ClassName App.jar argsToApp

位于 ${SPARK_HOME}/logs/ 的 master 的 spark 日志文件在 Spark 命令中有一个 -Xmx1g。这让我相信没有为我的应用程序分配命令行驱动程序内存。很快,我的应用程序死了 Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

有时抛出的异常是 java.lang.OutOfMemoryError : GC overhead limit exceeded

在上述之前我尝试过的另一件事:我用这个修改了 ${SPARK_HOME} /conf/spark-defaults.conf

spark.yarn.am.memory                12g
spark.yarn.am.cores                 3

master 的日志仍然在 Spark 命令中显示 -Xmx1g 并且应用程序以 java.lang.OutOfMemoryError : GC overhead limit exceeded 结束

我的 yarn-site.xml 中的相关属性如下:

  <!-- number of physical cores available per data node -->
  <property>
     <name>yarn.nodemanager.resource.cpu-vcores</name>
     <value>4</value>
  </property>

  <!-- the total RAM available per data node. amount of physical memory that can be allocated for containers aka amount of memory YARN can use on this node. This property should be lower than total memory of the machine. For example,leave 1GB out of the physical memory for host OS and other daemons-->
  <property>
     <name>yarn.nodemanager.resource.memory-mb</name>
     <!-- <value>12288</value> -->
     <!-- <value>16384</value> -->
        <value>15360</value>
  </property>

  <!-- the minimum RAM in MB to allocate per container. These ranges are used for decided whether requested spark executors can be fulfilled or not. If very high number of executors are requested then this min will be allocated to the containers. -->
  <property>
     <name>yarn.scheduler.minimum-allocation-mb</name>
   <value>8192</value>
  </property>

我已经提到了这些问题:123(这个答案提到更改 Java 应用程序的堆大小 - 通过 -Xmx 但我不确定如何以及在哪里做),4;以及 spark-2.4.7 here 的文档,其中讨论了在客户端模式下运行 YARN 时配置 spark.yarn.am.memoryspark.yarn.am.cores

请指出我在这里遗漏了什么。感谢您的时间和关注。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。