Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spark on YARN too less vcores used

I'm using Spark in a YARN cluster (HDP 2.4) with the following settings:

  • 1 Masternode
    • 64 GB RAM (50 GB usable)
    • 24 cores (19 cores usable)
  • 5 Slavenodes
    • 64 GB RAM (50 GB usable) each
    • 24 cores (19 cores usable) each
  • YARN settings
    • memory of all containers (of one host): 50 GB
    • minimum container size = 2 GB
    • maximum container size = 50 GB
    • vcores = 19
    • minimum #vcores/container = 1
    • maximum #vcores/container = 19

When I run my spark application with the command spark-submit --num-executors 30 --executor-cores 3 --executor-memory 7g --driver-cores 1 --driver-memory 1800m ... YARN creates 31 containers (one for each executor process + one driver process) with the following settings:

  • Correct: Master container with 1 core & ~1800 MB RAM
  • Correct: 30 slave containers with ~7 GB RAM each
  • BUT INCORRECT: each slave container only runs with 1 core instead of 3, according to the YARN ResourceManager UI (it shows only 31 of 95 in use, instead of 91 = 30 * 3 + 1), see screenshot below

enter image description here

My question here: Why does the spark-submit parameter --executor-cores 3 have no effect?

like image 483
D. Müller Avatar asked Jul 14 '16 08:07

D. Müller


People also ask

Can you use Spark with YARN?

There are two deploy modes that can be used to launch Spark applications on YARN. In cluster mode, the Spark driver runs inside an application master process which is managed by YARN on the cluster, and the client can go away after initiating the application.

What are the two ways to run Spark on YARN?

Spark supports two modes for running on YARN, “yarn-cluster” mode and “yarn-client” mode.

What are Vcores in YARN?

A vcore is a share of host CPU that the YARN Node Manager allocates to available resources. yarn. scheduler. maximum-allocation-vcores is the maximum allocation for each container request at the Resource Manager, in terms of virtual CPU cores.


1 Answers

Ok, seems to be the same issue as discussed here: yarn is not honouring yarn.nodemanager.resource.cpu-vcores The solution also worked for me.

like image 187
D. Müller Avatar answered Sep 19 '22 16:09

D. Müller