Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
Databricks · Databricks Spark Developer Associate

Spark Connect and Deploy Modes

Databricks Spark Developer Associate · Lesson 17 of 18 · 2:20:40

YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗

Learning with these videos? Subscribe for new courses and exam-style questions.

In this lesson

Prepare for the Databricks Certified Associate Developer for Apache Spark exam. In this lesson: the Spark Connect architecture (unresolved plans over gRPC, results as Arrow batches), its features and limits, client and cluster deploy modes, and local mode. Includes three original practice questions.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

Laptops, editors, a shared driver

Coralpeak's analysts want to run Spark code from their laptops and their editors, without one heavy notebook crashing a shared driver for everyone. The platform team must also choose where the driver of each scheduled job runs. This lesson covers the Spark Connect architecture, its features and limits, the client and cluster deploy modes, and local mode.

The Spark Connect architecture

Spark Connect splits Spark into a client and a server: the client runs your program, and the server, next to the cluster, runs the queries. The client translates DataFrame operations into unresolved logical plans, encoded as protocol buffers, and sends them to the server over gRPC. The server analyzes, optimizes, and runs each plan on the cluster, then streams the results back to the client as Apache Arrow batches. You connect by passing the address of the server to the remote method of the session builder, on port fifteen thousand and two by default. Since the client only sends plans, it can be a thin library, in Python, Scala, or other languages, with no Java virtual machine of its own.

Features and limits

Because the client is separate, a heavy or failing client program cannot take down a driver that other users share, which makes Spark more stable for many users. The server can be upgraded without changing every client, and the client can run anywhere, such as in an editor on a laptop, which makes debugging easier. There are limits: a Spark Connect client has no SparkContext and no RDD API, so code that uses RDDs, broadcast variables, or accumulators needs the classic mode. Schema analysis is also lazy, so an error, such as a missing column, may only appear when an action runs, rather than when the transformation is written. On Databricks, serverless compute, the standard access mode, and Databricks Connect all rely on Spark Connect.

Client and cluster deploy modes

When you submit an application to a cluster, for example with spark-submit, the deploy mode decides where its driver runs. In client mode, the default, the driver runs inside the process that submitted the job, outside the cluster, and its output appears in your console. It suits interactive work, such as a shell or a notebook, but the submitting machine must stay connected, close to the cluster, for the whole run. In cluster mode, the driver is launched on one of the machines of the cluster, so the submitting machine can disconnect, which suits long scheduled jobs. In that mode, the output of the driver goes to its log on the cluster, not to your console.

Local mode

Local mode runs the whole application on one machine, in a single Java virtual machine that acts as both the driver and the executor, with no cluster at all. The master setting local runs one thread, local with a number runs that many threads, and local with an asterisk runs one thread for each core of the machine. It is meant for development, unit tests, and small data, since it cannot grow beyond one machine. Code written in local mode runs unchanged on a cluster, which makes it a quick way to try out transformations before deploying them.

Recap

Let's recap. Spark Connect splits Spark into a thin client and a server, which exchange unresolved plans over gRPC, and results as Arrow batches. It isolates clients from a shared driver, lets the server be upgraded on its own, and supports debugging from an editor. A Spark Connect client has no SparkContext and no RDD API, and analyzes schemas lazily. In client mode, the driver runs in the submitting process, while in cluster mode, it runs on the cluster. And local mode runs everything in one process on one machine, for development and tests.

Quick checks for this lesson

The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.

  1. With Spark Connect, what does the client send to the server for a DataFrame query?

    • The Python code, to run on the server
    • An unresolved logical plan, over gRPC
    • A compiled physical plan, ready to run
    • The data to process, as Arrow batches
    Show the answer

    An unresolved logical plan, over gRPC

    The client builds an unresolved logical plan, and the server analyzes and runs it. “The Python code, to run on the server” is wrong, since the client sends a plan, not the program itself. “A compiled physical plan, ready to run” is wrong, since the server does the analysis and the optimization. And “The data to process, as Arrow batches” is wrong, since Arrow batches carry the results back, from the server to the client.

  2. A nightly job is submitted from a laptop, which is turned off right after the submission. Which deploy mode keeps the job running?

    • Client mode
    • Local mode, with every core
    • Client mode, with more executors
    • Cluster mode
    Show the answer

    Cluster mode

    In cluster mode, the driver runs on the cluster, so the laptop can disconnect. “Client mode” would run the driver on the laptop, and the job would stop with it. “Local mode, with every core” would run everything on the laptop itself. And “Client mode, with more executors” would still run the driver on the laptop.

  3. A developer wants unit tests of transformations to run on a laptop, with all of its cores, and no cluster. Which master setting fits?

    • local[*]
    • local
    • yarn
    • sc://localhost:15002
    Show the answer

    local[*]

    Local with an asterisk runs everything on the laptop, with one thread for each core. “local” would use a single thread only. “yarn” would need a YARN cluster. And “sc://localhost:15002” would need a Spark Connect server, which this setup does not have.