Sub topic 1
The Compute Landscape in Databricks
Prerequisites
This chapter assumes basic familiarity with Databricks workspaces and notebooks, Spark drivers and executors, cloud virtual machines, and JSON or YAML. You should know that a Spark job divides work across executors.
Compute Types
Databricks compute is the processing capacity that runs notebooks, SQL, and jobs. The main choices are:
| Compute type | Lifecycle | Typical use |
|---|---|---|
| All-purpose cluster | Started and stopped by users | Interactive development |
| Job cluster | Created for a run and terminated afterward | Scheduled production work |
| Serverless compute | Managed automatically by Databricks | Quick notebooks and jobs |
A cluster is a group of cloud virtual machines configured to work as one Spark environment.
Cluster Anatomy
The driver is the coordinating process. It interprets notebook commands, creates Spark jobs, schedules tasks, and tracks results. Workers are virtual machines that run executor processes. Executors read data, perform transformations, and return results to the driver.
A driver failure usually ends the application. A worker failure may be recoverable if Spark can rerun the lost tasks. Large data or complex driver-side operations can still overwhelm the driver.
Runtime and Photon
The Databricks Runtime is the software bundle installed on compute. It includes Apache Spark, language libraries, connectors, and Databricks features. Choose a supported runtime that matches your libraries and deployment requirements. Test upgrades because behavior and dependency versions can change.
Photon is Databricks' native vectorized execution engine. It can speed up many SQL and DataFrame workloads, especially scans, joins, and aggregations. It does not accelerate every custom Python operation, so compare measured runtime and cost before making it mandatory.
Access Modes and Unity Catalog
An access mode controls how users and code share a cluster and reach governed data. For Unity Catalog workloads, use a supported standard or single-user mode that matches your identity and isolation requirements. Shared access can support collaboration, while single-user access provides stronger user isolation for dedicated workloads.
All-Purpose Clusters
An all-purpose cluster remains available for interactive users until they stop it or auto termination shuts it down. It supports iterative notebook development, debugging, and exploration. Teams may share one, but sharing can cause resource contention and makes costs harder to attribute. Configure autoscaling and a short idle timeout to reduce unused capacity.
Exercise
Which compute type usually fits a scheduled nightly pipeline?
Show answer
A job cluster, because Databricks can create it for the run and terminate it when the run finishes.