Skip to content

Commit 0bb5b73

Browse files
Luc BourlierAndrew Or
authored andcommitted
[SPARK-13002][MESOS] Send initial request of executors for dyn allocation
Fix for [SPARK-13002](https://issues.apache.org/jira/browse/SPARK-13002) about the initial number of executors when running with dynamic allocation on Mesos. Instead of fixing it just for the Mesos case, made the change in `ExecutorAllocationManager`. It is already driving the number of executors running on Mesos, only no the initial value. The `None` and `Some(0)` are internal details on the computation of resources to reserved, in the Mesos backend scheduler. `executorLimitOption` has to be initialized correctly, otherwise the Mesos backend scheduler will, either, create to many executors at launch, or not create any executors and not be able to recover from this state. Removed the 'special case' description in the doc. It was not totally accurate, and is not needed anymore. This doesn't fix the same problem visible with Spark standalone. There is no straightforward way to send the initial value in standalone mode. Somebody knowing this part of the yarn support should review this change. Author: Luc Bourlier <[email protected]> Closes #11047 from skyluc/issue/initial-dyn-alloc-2.
1 parent 66e1383 commit 0bb5b73

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/CoarseMesosSchedulerBackend.scala

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,17 @@ private[spark] class CoarseMesosSchedulerBackend(
8787
val failuresBySlaveId: HashMap[String, Int] = new HashMap[String, Int]
8888

8989
/**
90-
* The total number of executors we aim to have. Undefined when not using dynamic allocation
91-
* and before the ExecutorAllocatorManager calls [[doRequestTotalExecutors]].
90+
* The total number of executors we aim to have. Undefined when not using dynamic allocation.
91+
* Initially set to 0 when using dynamic allocation, the executor allocation manager will send
92+
* the real initial limit later.
9293
*/
93-
private var executorLimitOption: Option[Int] = None
94+
private var executorLimitOption: Option[Int] = {
95+
if (Utils.isDynamicAllocationEnabled(conf)) {
96+
Some(0)
97+
} else {
98+
None
99+
}
100+
}
94101

95102
/**
96103
* Return the current executor limit, which may be [[Int.MaxValue]]

docs/running-on-mesos.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -246,18 +246,15 @@ In either case, HDFS runs separately from Hadoop MapReduce, without being schedu
246246

247247
# Dynamic Resource Allocation with Mesos
248248

249-
Mesos supports dynamic allocation only with coarse grain mode, which can resize the number of executors based on statistics
250-
of the application. While dynamic allocation supports both scaling up and scaling down the number of executors, the coarse grain scheduler only supports scaling down
251-
since it is already designed to run one executor per slave with the configured amount of resources. However, after scaling down the number of executors the coarse grain scheduler
252-
can scale back up to the same amount of executors when Spark signals more executors are needed.
253-
254-
Users that like to utilize this feature should launch the Mesos Shuffle Service that
255-
provides shuffle data cleanup functionality on top of the Shuffle Service since Mesos doesn't yet support notifying another framework's
256-
termination. To launch/stop the Mesos Shuffle Service please use the provided sbin/start-mesos-shuffle-service.sh and sbin/stop-mesos-shuffle-service.sh
257-
scripts accordingly.
258-
259-
The Shuffle Service is expected to be running on each slave node that will run Spark executors. One way to easily achieve this with Mesos
260-
is to launch the Shuffle Service with Marathon with a unique host constraint.
249+
Mesos supports dynamic allocation only with coarse-grain mode, which can resize the number of
250+
executors based on statistics of the application. For general information,
251+
see [Dynamic Resource Allocation](job-scheduling.html#dynamic-resource-allocation).
252+
253+
The External Shuffle Service to use is the Mesos Shuffle Service. It provides shuffle data cleanup functionality
254+
on top of the Shuffle Service since Mesos doesn't yet support notifying another framework's
255+
termination. To launch it, run `$SPARK_HOME/sbin/start-mesos-shuffle-service.sh` on all slave nodes, with `spark.shuffle.service.enabled` set to `true`.
256+
257+
This can also be achieved through Marathon, using a unique host constraint, and the following command: `bin/spark-class org.apache.spark.deploy.mesos.MesosExternalShuffleService`.
261258

262259
# Configuration
263260

0 commit comments

Comments
 (0)