Understanding resource allocation for Meso spark operations

I am working on a project in Spark and have recently switched from using Spark Standalone to Mesos to manage clusters. Now I'm confused about how to allocate resources when submitting jobs on the new system.

In offline mode, I used something like this (following the recommendations of this Cloudera blog post :

/opt/spark/bin/spark-submit --executor-memory 16G --executor-cores 8 --total-executor-cores 240 myscript.py 

This is a cluster in which each machine has 16 cores and RAM ~ 32 GB.

What was nice about this was that I had good control over the number of executors and resources allocated for each. In the above example, I knew that I was getting 240/8 = 30 artists, each of which has 16 GB of memory and 8 cores. Given the memory on each machine in the cluster, this will be no more than two performers working on each machine. If I wanted more performers, I could do something like

 /opt/spark/bin/spark-submit --executor-memory 10G --executor-cores 5 --total-executor-cores 240 myscript.py 

Now it will give me 240/5 = 47 artists, each of which has 5 cores and 10 GB of memory, and will allow up to 3 artists per machine.

But now that I'm on the Meso, I'm a little confused. Firstly, I work in rough mode to ensure that I can fix and control the allocation of resources (this is in the service of a rather complex model where we want to pre-allocate resources).

Now I can specify --total-executor-cores and --executor-memory , but the documentation tells me that --exeuctor-cores applies only to Spark and YARN independents, which allows me to specify the total number of artists and resources allocated for each complicated. Say I ran this:

 /opt/spark/bin/spark-submit --total-executor-cores 240 --executor-memory 16G --conf spark.mesos.coarse=true myscript.py 

When I learn this work in the Mesos web interface, everything starts to get confused. So here are my questions:

  • Terminology. The web interface displays โ€œframesโ€ which, I believe, correspond to โ€œtasksโ€ in the standalone user interface. But when I click on the details for a given structure, it lists the "tasks". But they may not be the actual tasks of Spark, right? As far as I can tell, โ€œtaskโ€ here should actually mean โ€œexecutorโ€ in relation to Spark. This will correspond to the user interface, which says that my infrastructure (work) has: 15 active tasks, 240 processors and 264 GB of memory.

    264/15 = 17.6, which looks like 16 GB of memory for each artist I specified (plus some overhead, I think). Am I interpreting all this correctly?

  • Assuming yes, when I look at any of these โ€œtasksโ€ (performers), I see that each of them has 16 cores. Given that we have 16 cores per machine, this seems to indicate that I basically run one performer on each of the 16 machines, and each performer receives all 16 cores, but only 16 GB of RAM. (note that even if I lowered --executor-memory down to something like 4 GB, mesos still just runs one executor per node, with 16 cores and 4 GB of RAM). But what I want to accomplish is something like my first two examples. That is, I want to run several executors per node, each of which shares RAM and the kernels of this node (that is, a moderate number of preliminary kernel executors, 5-8). Given that I cannot specify --executor-cores in Mesos, how do I do this? Or am I somehow leaving the base, even wanting to do it? Will Mesos simply not allow multiple exeuctors per node?

+5
source share
2 answers

Question 1: In coarse-grained mode, the Spark executor (org.apache.spark.executor.CoarseGrainedExecutorBackend) starts as a Mesos task. Mesos Framework is a Spark Driver. One Spark Driver can send multiple Spark jobs. It depends on your Spark application. Spark and Mesos are taken from AMPLab UC Berkeley and are developed in parallel, so they use similar terms (artist, task ...), which may confuse you :-).

Question 2: In rough mode, Spark runs only one artist per host (for more details see https://issues.apache.org/jira/browse/SPARK-5095 ). So for you, Spark will launch one artist per host (each artist consumes 16 GB of memory and all available kernels in a host that has 16 cores, if there is no other workload), until the total kernel of the artists reaches 240 cores. There will be 240/16 = 15 performers.

As for spark.mesos.mesosExecutor.cores, it only works for fine-grained mode. In fine-grained mode, Spark will launch one artist (org.apache.spark.executor.MesosExecutorBackend) per host. The contractor consumes the number of spark.mesos.mesosExecutor.cores cores, although there is no task. Each task will consume a different number of spark.task.cpus cores.

+4
source

Relatively 1)

This is also my understanding. Mesos task is actually a Spark executor.

Relatively 2)

As far as I understand, you should use the spark.mesos.mesosExecutor.cores configuration spark.mesos.mesosExecutor.cores :

(Fine-grained mode only) Number of cores for each Mesos artist. This does not include the kernels used to run Spark tasks. In other words, even if the Spark task does not start, each Mesos executor will occupy the number of cores configured here. The value may be a floating point number.

Cm

0
source

Source: https://habr.com/ru/post/1237932/


All Articles