Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala 长时间运行后,火花驱动侧运行超出内存_Scala_Apache Spark_Spark Dataframe - Fatal编程技术网

Scala 长时间运行后,火花驱动侧运行超出内存

Scala 长时间运行后,火花驱动侧运行超出内存,scala,apache-spark,spark-dataframe,Scala,Apache Spark,Spark Dataframe,我得到一个简单的spark应用程序。让我烦恼的是,在运行了大约10个小时后,驱动程序出现了一个错误,即有3GB内存,但实际上使用了4.7GB。 我的逻辑很简单: 首先获取所有文件路径并将它们存储到名为allpath的Seq中。 接下来,allpath.map(path=>upsert(getStatistics(path))getStatistics函数用于计算该路径下的文件记录数,如下所示: val parquetDF = sqlContext.read.parquet("/path/to/p

我得到一个简单的spark应用程序。让我烦恼的是,在运行了大约10个小时后,驱动程序出现了一个错误,即有3GB内存,但实际上使用了4.7GB。 我的逻辑很简单: 首先获取所有文件路径并将它们存储到名为
allpath
Seq
中。 接下来,
allpath.map(path=>upsert(getStatistics(path))
getStatistics
函数用于计算该路径下的文件记录数,如下所示:

val parquetDF = sqlContext.read.parquet("/path/to/parquet/files")
parquetDF.register("tmp_table")
resDF.sqlContext.sql("select count(*) record_num from tmp_table").withColumn(...).withColumn(...)
upsert
函数的目标是按分区对mysql数据库中的目标表执行
insert…on duplicate key…
操作:

val sql = """insert into table ...... on duplicate key id = id"""
currentDF.foreachPartition(iter => {
val state = create statement
while(iter.hasNext) {
val row = iter.next()
state.addBatch(sql.format(...))
}
state.executeBatch()
})
基本上,在整个过程中,我找不到太多需要使用驾驶员侧内存的东西。这是否是导致使用太多驾驶员侧内存的其他原因?欢迎提供任何建议

附言: spark提交配置:

  --driver-memory 2g --executor-cores 2
--driver-java-options="-XX:+UseG1GC"
--executor-memory 6g --num-executors 8
--conf spark.yarn.executor.memoryOverhead=1000 --conf spark.yarn.driver.memoryOverhead=1000

为什么驱动端为什么不是群集端?执行驱动端是有效的。@RamPrasadG实际上,我是在群集模式下运行的。我只是不知道为什么我的驱动端内存使用率这么高。请在这里粘贴完整的逻辑!对不起,我误解了。你升级foreachpartition的方式是正确的。为什么驱动端为什么不是群集端?执行驱动程序端处于有效状态。@RamPrasadG实际上,我是在群集模式下运行的。我只是不知道为什么我的驱动程序端内存使用率这么高。请在这里粘贴完整的逻辑!对不起,我误解了。您使用foreachpartition升级的方式是正确的。