log4j.logger.org.apache.spark.ExecutorAllocationManager=INFO
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 Add the following line to Refer to Logging. |
addExecutors
Method
Caution
|
FIXME |
removeExecutor
Method
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.
|
It requests executors using the input ExecutorAllocationClient. It requests spark.dynamicAllocation.initialExecutors.
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
Method
updateAndSyncNumExecutorsTarget(now: Long): Int
updateAndSyncNumExecutorsTarget
…FIXME
If ExecutorAllocationManager
is initializing it returns 0
.
Resetting ExecutorAllocationManager
— reset
Method
reset(): Unit
reset
resets ExecutorAllocationManager
to its initial state, i.e.
-
initializing is enabled (i.e.
true
). -
The currently-desired number of executors is set to the initial value.
-
The <<numExecutorsToAdd, ???> is set to
1
. -
All executor pending to remove are cleared.
-
All ??? are cleared.
initialNumExecutors
Attribute
Caution
|
FIXME |
numExecutorsTarget
Attribute
Caution
|
FIXME |
numExecutorsToAdd
Attribute
numExecutorsToAdd
attribute controls…FIXME
Stopping ExecutorAllocationManager
— stop
Method
stop(): Unit
stop
shuts down spark-dynamic-executor-allocation allocation executor.
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
Registry
Caution
|
FIXME |
spark-dynamic-executor-allocation Allocation Executor
spark-dynamic-executor-allocation
allocation executor is a…FIXME
It is started…
It is stopped…