Apache spark Spark-执行器心跳在X毫秒后超时

Apache spark Spark-执行器心跳在X毫秒后超时,apache-spark,Apache Spark,我的程序从目录中的文件读取数据,这些文件的大小是5GB。我对这些数据应用了许多函数。我在一个有32 GB RAM的虚拟机上以单机版(本地)运行spark 使用的命令: bin/spark-submit --class ripeatlasanalysis.AnalyseTraceroute --master local --driver-memory 30G SparkExample-lowprints-0.0.5-SNAPSHOT-jar-with-dependencies.jar

我的程序从目录中的文件读取数据,这些文件的大小是5GB。我对这些数据应用了许多函数。我在一个有32 GB RAM的虚拟机上以单机版(本地)运行spark

使用的命令:

bin/spark-submit --class ripeatlasanalysis.AnalyseTraceroute     --master local --driver-memory 30G  SparkExample-lowprints-0.0.5-SNAPSHOT-jar-with-dependencies.jar  1517961600  1518393600 3600 
1517961600 1518393600 3600
是jar文件的参数

有时程序运行时没有错误,有时没有错误,并且出现以下错误:

Exception in thread "main" org.apache.spark.SparkException: Job aborted due 
 to stage failure: Task 0 in stage 2.0 failed 1 times, most recent   failure: Lost task 
0.0 in stage 2.0 (TID 119, localhost, executor driver):  
ExecutorLostFailure (executor driver exited caused by one of the running   tasks) 
Reason: Executor heartbeat timed out after 128839 ms
 Driver stacktrace:
   at org.apache.spark.scheduler.DAGScheduler.org$apache$spark$scheduler$DAGSchedule  r$$failJobAndIndependentStages(DAGScheduler.scala:1887)
   at org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1875)

这个问题已经问了,没有人回答

我没有找到关于您的程序的太多信息,但通常情况下,这可能是由于网络问题,或者是由于计算问题,但您可以执行两个步骤。首先,以更多的数字重新划分您工作的数据帧,例如
df.repartition(1000)
,或者在连接的情况下,您可以基于连接列重新划分。还可以增加maxResultsSize

第二:您可以增加执行器和网络超时

--conf spark.network.timeout 10000000 --conf spark.executor.heartbeatInterval=10000000   --conf spark.driver.maxResultSize=4g 

spark.network.timeout
默认值(120秒)在我们的生产集群上通常太低,但在本地模式下您会遇到这种情况,这很奇怪。您是否尝试分析该过程?可能是gc等。我如何分析流程?你能给我一个我通常使用jvisualvm搜索的关键词吗。@samara下面的答案能解决你的问题吗?这个想法是增加超时时间,只做一些小的更改:--conf“spark.network.timeout=10000000”,而不是--conf spark.network.timeout 10000000。好的,这很好。但我认为你有一个集群问题。或者数据转换没有优化。我没有使用群集,我在本地运行spark。所以我应该复习一下我的代码。我使用的不是数据帧,而是数据集。将spark.executor.heartbeatInterval增加到10000000不是一个好主意。这意味着执行者将每10000000毫秒(即每166分钟)发送一次心跳信号。同时,将spark.network.timeout增加到166分钟也不是一个好主意。驱动程序将等待166分钟,然后移除执行器。您听说节拍间隔应该比网络超时小得多。