如何调出内存异常火花

how to tune out of memory exception spark

我有 11 个节点,每个节点有 2G 内存和 16 个内核,我尝试使用这个提交我的 spark 应用程序

./bin/spark-submit --class myapp.Main --master spark://Name:7077 --conf spark.shuffle.memoryFraction=0 --executor-memory 2G --deploy-mode client /home/mbala/fer/myjars7/etlpersist.jar /home/mfile80.csv 

在 Slaves 文件中,我没有在启动此命令时添加节点的 IP,因为我认为在客户端模式下,驱动程序必须 运行ning 在此节点中。

但是每当我尝试 运行 它时,我都会出现内存不足异常(有时是因为 GC 或因为堆),我尝试了 spark 网站和 Whosebug 中建议的许多解决方案,我还尝试最小化我的代码,我使用了 MemoryAndDiskStorage 但即使这样我仍然有这个问题

Ps:我使用这一行是因为我在这个论坛中找到了它作为解决方案

--conf spark.shuffle.memoryFraction=0

should i minimize the number of cores? because i think that if i use 16 cores with only 2G memory it won't be enough for shuffle

能否尝试将小 g--executor-memory 一起使用命令中的 --driver-memory 个选项对您有帮助。

当你设置执行器内存为2GB。然后它只分配0.6%的原始内存进行存储和执行,并从0.5%作为存储内存0.6%原始内存。因此只有 0.5% 内存可用于执行。

你应该明白memory management这个概念。它将帮助您调试应用程序。