ExecutorAllocationManager — Allocation Manager for Spark Core

ExecutorAllocationManager is responsible for dynamically allocating and removing executors based on the workload.

It intercepts Spark events using the internal ExecutorAllocationListener that keeps track of the workload (changing the internal registries that the allocation manager uses for executors management).

It uses ExecutorAllocationClient, LiveListenerBus, and SparkConf (that are all passed in when ExecutorAllocationManager is created).

Tip

Enable INFO logging level for org.apache.spark.ExecutorAllocationManager logger to see what happens inside.

Add the following line to conf/log4j.properties:

log4j.logger.org.apache.spark.ExecutorAllocationManager=INFO

Refer to Logging.

addExecutors

Caution
FIXME

removeExecutor

Caution
FIXME

maxNumExecutorsNeeded method

Caution
FIXME

Starting ExecutorAllocationManager (start method)

start(): Unit

start registers ExecutorAllocationListener (with LiveListenerBus) to monitor scheduler events and make decisions when to add and remove executors. It then immediately starts spark-dynamic-executor-allocation allocation executor that is responsible for the scheduling every 100 milliseconds.

Note
100 milliseconds for the period between successive scheduling is fixed, i.e. not configurable.
Note
start is called while SparkContext is being created (with dynamic allocation enabled).

Scheduling Executors — schedule Method

schedule(): Unit

schedule calls updateAndSyncNumExecutorsTarget to…​FIXME

It then go over removeTimes to remove expired executors, i.e. executors for which expiration time has elapsed.

updateAndSyncNumExecutorsTarget

updateAndSyncNumExecutorsTarget(now: Long): Int

updateAndSyncNumExecutorsTarget…​FIXME

If ExecutorAllocationManager is initializing it returns 0.

initializing flag

initializing flag starts enabled (i.e. true).

Resetting (reset method)

reset(): Unit

reset resets ExecutorAllocationManager to its initial state, i.e.

  1. initializing is enabled (i.e. true).

  2. The currently-desired number of executors is set to the initial value.

  3. The <<numExecutorsToAdd, ???> is set to 1.

  4. All executor pending to remove are cleared.

  5. All ??? are cleared.

initialNumExecutors attribute

Caution
FIXME

numExecutorsTarget attribute

Caution
FIXME

numExecutorsToAdd attribute

numExecutorsToAdd attribute controls…​FIXME

Stopping ExecutorAllocationManager — stop Method

stop(): Unit
Note
It waits 10 seconds for the complete termination.

Internal Registries

executorsPendingToRemove registry

Caution
FIXME

removeTimes registry

removeTimes keeps track of executors and their…​FIXME

executorIds

Caution
FIXME

spark-dynamic-executor-allocation Allocation Executor

spark-dynamic-executor-allocation allocation executor is a…​FIXME

It is started…​

It is stopped…​

results matching ""

    No results matching ""