2

我在一台机器上设置了一个 Apache Spark 1.6.1 独立集群,具有以下规格:

  • CPU:Core i7-4790(核心数:4,线程数:8)
  • 内存:16GB

我在 conf/spark-env.sh 中使用以下设置

export SPARK_WORKER_MEMORY 
export SPARK_WORKER_INSTANCES 
export SPARK_WORKER_CORES
export SPARK_WORKER_DIR

由于机器有一个 4 核处理器,我认为可能的配置可能是:

export SPARK_WORKER_MEMORY = 14g
export SPARK_WORKER_INSTANCES = 1
export SPARK_WORKER_CORES = 1
export SPARK_WORKER_DIR =/local_drive/sparkdata

export SPARK_WORKER_MEMORY = 14g
export SPARK_WORKER_INSTANCES = 1
export SPARK_WORKER_CORES = 2
export SPARK_WORKER_DIR =/local_drive/sparkdata

export SPARK_WORKER_MEMORY = 14g
export SPARK_WORKER_INSTANCES = 1
export SPARK_WORKER_CORES = 3
export SPARK_WORKER_DIR =/local_drive/sparkdata

export SPARK_WORKER_MEMORY = 14g
export SPARK_WORKER_INSTANCES = 1
export SPARK_WORKER_CORES = 4
export SPARK_WORKER_DIR =/local_drive/sparkdata

export SPARK_WORKER_MEMORY = 7g
export SPARK_WORKER_INSTANCES = 2
export SPARK_WORKER_CORES = 1
export SPARK_WORKER_DIR =/local_drive/sparkdata

export SPARK_WORKER_MEMORY = 7g
export SPARK_WORKER_INSTANCES = 2
export SPARK_WORKER_CORES = 2
export SPARK_WORKER_DIR =/local_drive/sparkdata

export SPARK_WORKER_MEMORY = 4.5g
export SPARK_WORKER_INSTANCES = 3
export SPARK_WORKER_CORES = 1
export SPARK_WORKER_DIR =/local_drive/sparkdata

export SPARK_WORKER_MEMORY = 3.5g
export SPARK_WORKER_INSTANCES = 4
export SPARK_WORKER_CORES = 1
export SPARK_WORKER_DIR =/local_drive/sparkdata

所以我的想法是:

  • 内存必须在工作实例的数量之间分配,
  • 每个工作实例的工作核心数量乘以,因此,我不能有 4 个工作实例和 2 个工作核心,因为我没有 8 个核心。

问题是我测试了配置,并设置:

export SPARK_WORKER_MEMORY = 14g
export SPARK_WORKER_INSTANCES = 3
export SPARK_WORKER_CORES = 40
export SPARK_WORKER_DIR =/local_drive/sparkdata

而且我遇到了任何错误,而且在 Apache Web UI 中它显示为“40 核”。怎么了?那么我真的可以拥有多少个工作核心和工作实例?

提前致谢。

4

0 回答 0