Sub topic 2
Matching the cluster to the workload
This chapter assumes you know basic Spark (jobs, stages, tasks, partitions, shuffles), can run notebooks and jobs in a Databricks workspace, and understand cloud instance types and spot versus on-demand pricing.
A cluster that suits one workload can waste money or run slowly on another. Before you pick a node type or a size, name the workload profile. The profile tells you which resource is likely to be the bottleneck and how the cluster will be used over time.
The four common profiles
| Profile | Typical work | Usage pattern | What usually limits it |
|---|---|---|---|
| ETL | Scheduled batch reads, joins, writes | Predictable, runs then stops | Shuffle, disk, and total cores |
| Interactive | Notebook exploration, ad hoc queries | Bursty, long idle gaps | Driver memory, idle cost |
| ML | Feature prep, training, tuning | Heavy and long-running | Memory per node, or GPUs |
| BI | Dashboards and SQL queries from many users | Many short queries at once | Concurrency and query latency |
ETL
ETL jobs have a clear start and end. Run them on a job cluster that exists only for the run. Size for throughput: enough cores to process the data in the time window you have. Shuffle-heavy jobs benefit from nodes with fast local storage.
Interactive
People think, type, and wait, so utilization is low and uneven. The cost risk is a cluster left running overnight. Pair it with auto-termination (covered later) and keep the node size modest. Collecting results to the driver is common here, so the driver needs enough memory.
ML
Training often needs more memory per node than ETL, because data and models sit in memory. Deep learning needs GPU nodes. Some libraries run on the driver only, so a large driver with few workers can be the right shape.
BI
Many users send short queries at the same time. The goal is low latency under concurrency, not raw throughput. This is where SQL-oriented compute and, later in the tutorial, serverless options fit best.
Choosing by profile
Use the profile to set the first decisions:
- Cluster type. Use a job cluster for scheduled ETL. Use an all-purpose cluster for interactive work.
- Resource emphasis. Choose memory, compute, storage, or GPU, as the next chapter explains.
- Scaling style. Predictable work suits a fixed size. Variable load suits autoscaling.
Common errors
- Running scheduled ETL on an all-purpose cluster. It costs more per unit of work and stays up after the job ends.
- Sizing an interactive cluster for peak load, then leaving it idle most of the day.
- Choosing a compute-heavy node for an ML job that fails with out-of-memory errors.
Exercise
A team runs a nightly 2-hour batch pipeline on an all-purpose cluster that stays up all day. Which profile is it, and what two changes match the cluster to the workload?
Show answer
It is an ETL workload. Move it to a job cluster that starts for the run and ends afterward, and size it to finish within the time window. This removes the idle hours and the higher all-purpose rate.