如何处理opecutor内存和驱动程序内存? 我对在Spark中与执行器内存和驱动程序内存打交道感到困惑。 我的环境设置如下: 内存128 g,16 CPU,用于9 VM Centos Hadoop 2.5.0-CDH5.2.0 火花1.1.0 输入数据

问题描述 投票:0回答:4

centos

HADOOP2.5.0-CDH5.2.0

    Spark1.1.0
  • 输入数据信息:
  • 3.3.5GB数据文件来自HDFS
对于简单的开发,我用独立的群集模式(8个工人,20个内核,45.3 g内存)执行了我的Python代码。现在,我想设置执行器内存或驱动程序内存进行性能调整。

SparkDocument
    ,执行器内存的定义为
  • amount以与JVM内存字符串(例如512m,2G)相同的格式使用每个执行程序进程的内存。

驱动器内存如何?

    

您需要分配给驱动程序的内存取决于作业。 If the job is based purely on transformations

and terminates on some distributed output action like rdd.saveAsTextFile, rdd.saveToCassandra, ... then the memory needs of the driver will be very low. MB的100个会做。驱动程序还负责传递文件和收集指标,但不参与数据处理。

如果工作要求驾驶员参加计算
,例如some ML algo that needs to materialize results and broadcast them on the next iteration, then your job becomes dependent of the amount of data passing through the driver. Operations like

spark-submit

,
memory-management apache-spark
4个回答
111
投票
and

.take

deliver data to the driver and hence, the driver needs enough memory to allocate such data.

e.g。 If you have an takeSample

of 3GB in the cluster and call

rdd, then you will need 3GB of memory in the driver to hold that data plus some extra room for the functions mentioned in the first paragraph.


在SPARK应用程序中,驱动程序负责任务调度,而执行程序负责执行您的作业中的具体任务。

如果您熟悉MapReduce,则您的地图任务和减少任务都在executor中执行(在Spark中,它们被称为shufflemaptasks&resultTasks),而且无论您想缓存的RDD所需的何种RDD,也都在Executor的JVM的堆中。
因此,我认为您的驾驶员还可以一些GB。
    

SPARKshell必需内存=(驱动程序内存 + 384 MB) +(执行者的数量 *(executor Memory + 384 MB))

here384 Mb是执行作业时Spark可能会使用的最大内存(开销)值。
    

spark

中的记忆

8
投票

Spark.driver.Overhead= 10%或384 MB(以更多为准)

Spark.driver.memory


2
投票
执行记忆 -spark.executor.Overhead = 10%或384 MB(以更多为准)

val myresultArray = rdd.collect


0
投票
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.