Spark - Container超出了物理内存限制

时间:2015-11-17 14:34:06

标签: hadoop apache-spark spark-graphx

我有两个工作节点的集群。 Worker_Node_1 - 64GB RAM Worker_Node_2 - 32GB RAM

背景摘要: 我试图在纱线簇上执行spark-submit以在Graph上运行Pregel来计算从一个源顶点到所有其他顶点的最短路径距离,并在控制台上打印这些值。 实验:

  1. 对于包含15个顶点的小图,执行完成应用程序最终状态:SUCCEEDED
  2. 我的代码运行完美,打印出单个顶点作为源顶点的241个顶点图的最短距离,但是存在问题。
  3. 问题: 当我深入了解日志文件时,任务在4分钟和26秒内完成成功,但仍然在终端上,它继续显示应用程序状态为正在运行,并在大约12个之后分钟任务执行终止说 -

    Application application_1447669815913_0002 failed 2 times due to AM Container for appattempt_1447669815913_0002_000002 exited with exitCode: -104 For more detailed output, check application tracking page:http://myserver.com:8088/proxy/application_1447669815913_0002/
    Then, click on links to logs of each attempt. 
    Diagnostics: Container [pid=47384,containerID=container_1447669815913_0002_02_000001] is running beyond physical memory limits. Current usage: 17.9 GB of 17.5 GB physical memory used; 18.7 GB of 36.8 GB virtual memory used. Killing container.
    
    Dump of the process-tree for container_1447669815913_0002_02_000001 : 
     |- PID PPID PGRPID SESSID CMD_NAME USER_MODE_TIME(MILLIS) SYSTEM_TIME(MILLIS) VMEM_USAGE(BYTES) RSSMEM_USAGE(PAGES) FULL_CMD_LINE
    |- 47387 47384 47384 47384 (java) 100525 13746 20105633792 4682973 /usr/lib/jvm/java-7-oracle-cloudera/bin/java -server -Xmx16384m -Djava.io.tmpdir=/yarn/nm/usercache/cloudera/appcache/application_1447669815913_0002/container_1447669815913_0002_02_000001/tmp -Dspark.eventLog.enabled=true -Dspark.eventLog.dir=hdfs://myserver.com:8020/user/spark/applicationHistory -Dspark.executor.memory=14g -Dspark.shuffle.service.enabled=false -Dspark.yarn.executor.memoryOverhead=2048 -Dspark.yarn.historyServer.address=http://myserver.com:18088 -Dspark.driver.extraLibraryPath=/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/hadoop/lib/native -Dspark.shuffle.service.port=7337 -Dspark.yarn.jar=local:/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/spark/lib/spark-assembly.jar -Dspark.serializer=org.apache.spark.serializer.KryoSerializer -Dspark.authenticate=false -Dspark.app.name=com.path.PathFinder -Dspark.master=yarn-cluster -Dspark.executor.extraLibraryPath=/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/hadoop/lib/native -Dspark.yarn.am.extraLibraryPath=/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/hadoop/lib/native -Dspark.yarn.app.container.log.dir=/var/log/hadoop-yarn/container/application_1447669815913_0002/container_1447669815913_0002_02_000001 org.apache.spark.deploy.yarn.ApplicationMaster --class com.path.PathFinder --jar file:/home/cloudera/Documents/Longest_Path_Data_1/Jars/ShortestPath_Loop-1.0.jar --arg /home/cloudera/workspace/Spark-Integration/LongestWorstPath/configFile --executor-memory 14336m --executor-cores 32 --num-executors 2
    |- 47384 47382 47384 47384 (bash) 2 0 17379328 853 /bin/bash -c LD_LIBRARY_PATH=/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/hadoop/lib/native::/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/hadoop/lib/native /usr/lib/jvm/java-7-oracle-cloudera/bin/java -server -Xmx16384m -Djava.io.tmpdir=/yarn/nm/usercache/cloudera/appcache/application_1447669815913_0002/container_1447669815913_0002_02_000001/tmp '-Dspark.eventLog.enabled=true' '-Dspark.eventLog.dir=hdfs://myserver.com:8020/user/spark/applicationHistory' '-Dspark.executor.memory=14g' '-Dspark.shuffle.service.enabled=false' '-Dspark.yarn.executor.memoryOverhead=2048' '-Dspark.yarn.historyServer.address=http://myserver.com:18088' '-Dspark.driver.extraLibraryPath=/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/hadoop/lib/native' '-Dspark.shuffle.service.port=7337' '-Dspark.yarn.jar=local:/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/spark/lib/spark-assembly.jar' '-Dspark.serializer=org.apache.spark.serializer.KryoSerializer' '-Dspark.authenticate=false' '-Dspark.app.name=com.path.PathFinder' '-Dspark.master=yarn-cluster' '-Dspark.executor.extraLibraryPath=/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/hadoop/lib/native' '-Dspark.yarn.am.extraLibraryPath=/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/hadoop/lib/native' -Dspark.yarn.app.container.log.dir=/var/log/hadoop-yarn/container/application_1447669815913_0002/container_1447669815913_0002_02_000001 org.apache.spark.deploy.yarn.ApplicationMaster --class 'com.path.PathFinder' --jar file:/home/cloudera/Documents/Longest_Path_Data_1/Jars/ShortestPath_Loop-1.0.jar --arg '/home/cloudera/workspace/Spark-Integration/LongestWorstPath/configFile' --executor-memory 14336m --executor-cores 32 --num-executors 2 1> /var/log/hadoop-yarn/container/application_1447669815913_0002/container_1447669815913_0002_02_000001/stdout 2> /var/log/hadoop-yarn/container/application_1447669815913_0002/container_1447669815913_0002_02_000001/stderr
    Container killed on request. Exit code is 143
    Container exited with a non-zero exit code 143
    Failing this attempt. Failing the application.
    

    我尝试的事情:

    1. yarn.schedular.maximum-allocation-mb - 32GB
    2. mapreduce.map.memory.mb = 2048(之前为1024)
    3. 尝试改变 - 驱动程序内存高达24g
    4. 您能否为我如何配置资源管理器添加更多颜色,以便还可以处理大尺寸图形(> 300K顶点)?感谢。

5 个答案:

答案 0 :(得分:2)

您处理的数据越多,每个Spark任务所需的内存就越多。如果您的执行程序运行太多任务,那么它可能会耗尽内存。当我处理大量数据时遇到问题时,通常是因为没有正确平衡每个执行程序的内核数量。尝试减少核心数量或增加执行程序内存。

告诉您存在内存问题的一种简单方法是检查Spark UI上的Executor选项卡。如果你看到很多红条表示垃圾收集时间很长,你的执行器可能内存不足。

答案 1 :(得分:1)

我解决了我的情况下的错误,以增加代表堆外内存的 spark.yarn.executor.memoryOverhead 的配置 当您增加驱动程序内存和执行程序内存的数量时,请不要忘记此配置项

答案 2 :(得分:0)

Spark作业以与MapReduce作业不同的方式从资源管理器请求资源。尝试调整分配给每个执行程序的执行程序和mem / vcore的数量。关注http://spark.apache.org/docs/latest/submitting-applications.html

答案 3 :(得分:0)

只需将spark.driver.memory的默认conf从512m增加到2g就可以解决我的情况。

如果不断出现相同的错误,可以将内存设置为更高。然后,您可以继续减少它,直到遇到相同的错误为止,以便您知道用于工作的最佳驱动程序内存。

答案 4 :(得分:0)

我有类似的问题:

关键错误信息:

  • 退出代码:-104
  • “物理”内存限制
Application application_1577148289818_10686 failed 2 times due to AM Container for appattempt_1577148289818_10686_000002 exited with **exitCode: -104**

Failing this attempt.Diagnostics: [2019-12-26 09:13:54.392]Container [pid=18968,containerID=container_e96_1577148289818_10686_02_000001] is running 132722688B beyond the **'PHYSICAL' memory limit**. Current usage: 1.6 GB of 1.5 GB physical memory used; 4.6 GB of 3.1 GB virtual memory used. Killing container.

增加spark.executor.memoryspark.executor.memoryOverhead均无效。

然后我增加spark.driver.memory就解决了。