Understanding YARN Cluster Mode
The most commonly used deployment modes for Spark
Updated:
阅读中文版-
Executing a script to submit a job actually starts a SparkSubmit JVM process; the main method in the SparkSubmit class reflectively calls the main method of YarnClusterApplication, which creates a Yarn client and then sends an execution command to the Yarn server: bin/java ApplicationMaster;
-
After receiving the command, the Yarn framework starts ApplicationMaster in the specified NM;
-
ApplicationMaster starts the Driver thread to execute the user's job;
-
AM registers with RM and requests resources;
-
RM returns a list of available resources;
-
After obtaining resources, AM sends a command to NM: bin/java YarnCoarseGrainedExecutorBackend;
-
The CoarseGrainedExecutorBackend process receives messages, communicates with the Driver, and registers the started Executor; then starts the computation object Executor to wait for tasks;
-
The Driver thread continues to complete job scheduling and task execution.
-
The Driver assigns tasks and monitors their execution.
Note: SparkSubmit, ApplicationMaster, and CoarseGrainedExecutorBackend are independent processes; Driver is an independent thread; Executor and YarnClusterApplication are objects.

Comments(0)