CertSafari
    Databricks Certified Associate Developer for Apache Spark· Lessons

    Domain 6 · Lesson 30/32

    Spark deploy modes: client, cluster and local

    Describe the different deployment mode types (Client, Cluster, Local) in the Apache SparkTM environment.

    14 min read
    2.5% of exam
    7 sources
    Published 21 Oct 2026
    Docs as of 30 Sep 2026

    What you will be able to do

    • Say where the driver process runs in client, cluster and local mode
    • Match an interactive session, a scheduled production job or a laptop test to the deploy mode it uses
    • Explain why submitting a Python application to a standalone cluster in cluster deploy mode fails
    • Tell a Spark Connect session apart from client deploy mode

    Key concept

    Deploy mode — A deploy mode is a choice about where the driver process runs. In client mode it runs with the submitter, outside the cluster. In cluster mode it runs inside the cluster. In local mode the driver and the executors share one process on one machine.

    1.Deploy mode decides where the driver lives

    Every Spark application has one driver, which plans the work and schedules tasks, and a set of executors that run those tasks on worker nodes. A cluster manager such as Standalone, YARN or Kubernetes hands out the resources. Driver, worker nodes, executors and the cluster manager explains each part. Deploy modes leave all of that alone. They change one thing: where the driver process runs compared with the cluster.

    Where the driver runs matters because the driver lives as long as the application does. If the driver process dies, the application dies with it, however many executors are still healthy. So the deploy mode decides what the application depends on. In client mode it depends on the machine and session that launched it. In cluster mode it depends only on the cluster. In local mode it depends on a single process on one machine.

    With spark-submit you choose between the two cluster deploy modes with --deploy-mode client or --deploy-mode cluster. If you leave the flag out, you get client mode. Local mode doesn't come from --deploy-mode. You get it from the master setting: a local master URL such as local[*] instead of a cluster manager address.

    The three deploy modes compared by where the driver runs
    ModeWhere the driver runsWhere executors runTypical use
    clientOn the submitting machine, outside the clusterOn worker nodes in the clusterInteractive shells, notebooks, debugging
    clusterInside the cluster, launched by the frameworkOn worker nodes in the clusterScheduled production jobs submitted with spark-submit
    localIn one process on one machineIn that same process, as threadsUnit tests, local development, single node compute

    Checkpoint 1 of 8· Match them up

    Match each spark-submit setting to where the driver runs and what the application depends on

    Tap a term, then the definition that fits it.

    Sources12

    2.Client mode keeps the driver with the session

    In client mode the driver starts where the submission happened, outside the cluster, and stays tied to that session for the whole run. Each command you type goes straight to the driver, and its result comes straight back. That's why the interactive shells pyspark and spark-shell run in client mode. You type a transformation, call show() and see rows a second later.

    Two costs come with that. First, the driver must stay reachable from the executors for its whole lifetime, so the submitting machine needs a network path to the workers that doesn't break. Second, the driver schedules every task, so a laptop on a slow VPN to a remote cluster slows down every stage. Spark recommends running the driver close to the workers for this reason. And if you close the session or the submitting machine sleeps, the driver stops and the application ends.

    A Databricks notebook attached to an all-purpose (interactive) cluster behaves like client mode. The driver node keeps the notebook's state and runs each cell as you submit it, so you can check one transformation's output before you write the next cell. What makes the session client-style is that the driver is bound to your interactive session, not any particular machine. Cluster settings don't change that. Turning autoscaling on or off changes how many workers there are, not where the driver runs. Running cells also never spins up a new short-lived job cluster per cell: every cell goes to the same attached cluster and the same driver.

    Checkpoint 2 of 8· Check yourself

    An analyst starts pyspark on a laptop and connects over a slow VPN to a remote cluster. The executors are healthy, but every stage is slow. What is the most likely cause, and what helps?

    Checkpoint 3 of 8· Exam question

    A developer opens a Databricks notebook attached to an all-purpose (interactive) cluster and runs cells one at a time, checking the output of each transformation before writing the next cell. Which description of the deployment mode behind this session is accurate?

    Sources12

    3.Cluster mode hands the driver to the cluster

    In cluster mode, spark-submit passes the application to the cluster manager. The manager starts the driver on a node inside the cluster, and the submitting process has nothing left to do. The driver sits on the same network as the executors, so scheduling traffic stays local, and the run no longer depends on the machine or person that started it. That suits scheduled production work: nightly ETL, pipelines triggered by an orchestrator, anything that must finish with nobody watching.

    The trade-off is interactivity. Output that the driver prints, and any result it collects, ends up on a cluster node and in the driver logs, not in your terminal. Cluster mode is a poor choice for exploring data, and a good one for code that's already working.

    A Databricks Job that starts a new job cluster for each run, runs a PySpark script with no notebook attached, and then shuts the cluster down is a cluster-mode run. The driver runs on that job cluster's driver node, not on the control plane that scheduled the trigger, and Databricks sets up the Spark session itself. The run doesn't depend on any live session from whoever triggered it. Nothing has to be set on the job, such as --supervise, for this to be true. A job with no notebook doesn't fall back to local mode either: the job cluster's executors do the work.

    Not every cluster manager accepts cluster mode for every language. Spark's standalone cluster manager doesn't support cluster deploy mode for Python applications. So spark-submit --master spark://cluster-host:7077 --deploy-mode cluster app.py is rejected, while the same command with --deploy-mode client runs. The flags that usually get blamed aren't the cause. --supervise is an optional flag that restarts a failed driver, not something client mode requires. YARN's rules don't apply because a spark:// master URL means standalone. And cluster mode doesn't require every application file to be on hdfs://.

    Checkpoint 4 of 8· Check yourself

    A nightly Databricks Job starts a new job cluster, runs a PySpark script with no notebook attached, then shuts the cluster down. The engineer who set up the trigger logs off mid-run. Which statement about this run is correct?

    Checkpoint 5 of 8· Exam question

    A data engineer submits a PySpark job to an existing standalone Spark cluster from their local machine using the following command, and the submission fails immediately: spark-submit --master spark://cluster-host:7077 --deploy-mode cluster app.py What is the most likely reason cluster deploy mode is rejected here?

    Checkpoint 6 of 8· Exam question

    A production pipeline is scheduled as a Databricks Job that spins up a new job cluster for each run, executes a PySpark script with no notebook attached, and terminates the cluster once the script finishes. Which deployment mode characteristic applies to this run, and why?

    Sources13

    4.Local mode puts everything in one process

    Local mode has no cluster at all. The driver and the executors run inside one JVM on one machine, and tasks run as threads. The master URL sets how many threads: local uses one, local[4] uses four, and local[*] uses one per CPU core. A plain pyspark started on a laptop with no master configured starts with master = local[*].

    Local mode is the right choice for unit tests, small samples and checking logic in CI. Nothing needs provisioning, it starts in seconds, and every partition runs on the same machine. Production problems don't show up in it. There is no network shuffle between machines, no executor running out of memory on a separate worker, and no serialization to another host. A job that passes locally can still fail once it reaches a real cluster.

    Databricks uses local mode too. A single node compute resource has a driver node and no worker nodes, and Spark runs in local mode on that driver. This works well for small data or libraries that don't need parallel execution. For data larger than one machine can handle, choose a cluster with worker nodes.

    Checkpoint 7 of 8· Check yourself

    A data engineer runs a PySpark aggregation on a Databricks single node compute resource. How does Spark execute this job?

    Sources245

    5.Spark Connect is not client deploy mode

    Spark Connect can look like client mode, because your code runs on your laptop and results come back to it. It works differently. With Spark Connect, a thin client sends unresolved plans to a Spark server over gRPC, and the driver runs on the server side, inside the cluster. Spark Connect client-server architecture covers the protocol itself. For deploy modes, what matters is that the client process isn't the driver.

    Starting a PySpark shell as a Spark Connect client instead of a local or client-mode driverbash
    ./bin/pyspark --remote "sc://localhost"

    In client deploy mode, the machine running your code hosts the driver JVM. It has the SparkContext and must stay reachable from every executor. In a Spark Connect session your Python or Scala code runs locally, but the driver and the SparkContext stay on the server. The client can't reach them. If your laptop disconnects, you lose a client session, not the driver of a shared server. So 'my code runs locally' doesn't mean client mode. Ask whether the local process is the driver.

    Checkpoint 8 of 8· Fill the gap

    A developer wants a PySpark shell on their laptop where the local process is only a thin client, and the driver and SparkContext stay on the Spark server. Which flag completes the command?

    ./bin/pyspark  ?  "sc://localhost"

    Sources67

    Sources

    (7)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “Distinguishes where the driver process runs.”
      ↩︎ Deploy mode decides where the driver lives
      “As such, the driver program must be network addressable from the worker nodes.”
      ↩︎ Client mode keeps the driver with the session
      “Because the driver schedules tasks on the cluster, it should be run close to the worker nodes, preferably on the same local area network.”
      ↩︎ Client mode keeps the driver with the session
      “the framework launches the driver inside of the cluster”
      ↩︎ Cluster mode hands the driver to the cluster
      “Distinguishes where the driver process runs.”
      ↩︎ Key concept
      “the framework launches the driver inside of the cluster”
      ↩︎ Exam trap 3
      “In "cluster" mode, the framework launches the driver inside of the cluster. In "client" mode, the submitter launches the driver outside of the cluster.”
      ↩︎ Checkpoint
      “In "cluster" mode, the framework launches the driver inside of the cluster.”
      ↩︎ Checkpoint
    2. 2.
      “Databricks clusters consist of an Apache Spark driver node and zero or more Spark worker (also known as executor) nodes.”
      ↩︎ Deploy mode decides where the driver lives
      “The driver node maintains attached notebook state, maintains the SparkContext, interprets notebook and library commands”
      ↩︎ Client mode keeps the driver with the session
      “A single node cluster has one driver node and no worker nodes, with Spark running in local mode”
      ↩︎ Local mode puts everything in one process
      “A single node cluster has one driver node and no worker nodes, with Spark running in local mode”
      ↩︎ Exam trap 2
    3. 3.
      “You don't need to configure or initialize a Spark context or Spark session, as these are managed for you by Databricks.”
      ↩︎ Cluster mode hands the driver to the cluster
    4. 4.
      “Spark context available as 'sc' (master = local[*], app id = local-...).”
      ↩︎ Local mode puts everything in one process
    5. 6.
      “The client does not run in the same process as the Spark driver.”
      ↩︎ Spark Connect is not client deploy mode
    6. 7.
      “All code is executed locally, while all Spark code continues to run on the remote cluster.”
      ↩︎ Spark Connect is not client deploy mode
      “All code is executed locally, while all Spark code continues to run on the remote cluster.”
      ↩︎ Exam trap 1

    Ready to test yourself?

    Practise Databricks Certified Associate Developer for Apache Spark in quiz mode.

    Spotted a mistake, or was something unclear? Tell us.