VAYULearn
Colour theme
Investigate a failure
VAYU Learn

Spark & PySpark

Spark UI Masterclass - Reading Every Tab Like a Performance Engineer

Not a Beginner Guide. A Production Guide to Every Tab That Actually Matters When a Job Is Slow or Failing.

Spark & PySpark

TL;DR

  • The Jobs tab shows gaps between jobs — a gap with no stage running means the driver is doing planning work, not idle time, and that planning cost is often invisible elsewhere
  • The Stages tab’s task duration distribution is the single fastest way to detect skew — compare max to median, not average
  • The SQL tab’s physical plan tells you which join strategy actually ran — never assume, always confirm
  • The Executors tab’s GC Time column, checked against Task Time, is the earliest signal of memory pressure — before you see an OOM
  • The Storage tab tells you whether your caching decisions are actually helping or silently spilling to disk and providing no benefit

Most engineers open the Spark UI once, see a wall of numbers, and close it. The numbers are not noise — they are the fastest debugging path you have.


A job was taking 40 minutes. The engineer assigned to fix it spent two days trying different configuration changes. More memory. More executors. Different partition counts. Nothing moved the needle by more than a few minutes.
On the third day, someone opened the Jobs tab and noticed a 12-minute gap between two jobs with no stages running in between.
That gap was the driver building an execution plan for a query with 40 chained transformations and a badly nested set of when/otherwise conditions. Not a cluster problem. Not a data problem. A planning problem, invisible in every metric except the one nobody had looked at.
The fix: simplify the conditional logic into a lookup join. Planning time: 12 minutes → 8 seconds.

This Is Not a Tour

Most Spark UI guides describe what each tab shows. This one describes what to look at first, what it means when a specific number is high or low, and which tab answers which category of question. The goal is diagnostic speed — knowing where to look before you start guessing.


Jobs Tab - The Timeline That Reveals Driver Bottlenecks

What to Actually Look At

The Jobs tab lists every Spark job in the application with its duration and stage count. Most engineers scan the duration column and move on. The more useful information is the timeline view and the gaps within it.

Each job corresponds to an action — count(), write(), collect(). Between jobs, the driver is doing work that does not show up as a stage: query planning, DAG construction, catalog lookups, broadcast variable preparation.

The Gap Signal

Job 3 completed at 14:02:10
Job 4 started at 14:02:45

35 seconds with no stage running.
This is not idle time. This is driver-side work:
- Catalyst planning a complex query
- Broadcast variable being prepared and distributed
- Metadata being fetched from the catalog (partition listing)

A gap under a few seconds is normal — expected coordination overhead between actions. A gap measured in minutes on a job that otherwise looks fine is the first sign of a driver-side bottleneck: query complexity, catalog latency, or broadcast preparation for a table that turned out to be larger than expected.

To confirm the cause, check the driver logs for the timestamp range of the gap - the log entries during that window explain what the driver was doing.


Stages Tab - Where Skew and Shuffle Cost Live

This is the tab with the highest diagnostic value per minute spent. Most performance problems are visible here within 30 seconds of looking.

Task Duration Distribution

Click into any stage and look at the task summary metrics — minimum, 25th percentile, median, 75th percentile, and maximum duration.

Min:    8s
25th: 9s
Median: 10s
75th: 11s
Max: 210s ← 21x the median

This gap between median and max is the skew signal.
A healthy stage has max within 2-3x of median.
Anything beyond 5x means one or a few partitions
are holding disproportionate data or work.

Compare max to median, not to average — average is dragged toward the outlier and understates how extreme the skew actually is.

Shuffle Read and Write

The Shuffle Read and Shuffle Write columns tell you how much data moved across the network for this stage. This is the number to check before assuming a slow stage is a compute problem.

Stage 12: Shuffle Write: 480 GB, Shuffle Read: 480 GB
Stage duration: 22 minutes

480 GB moved across the network is almost certainly
the dominant cost of this stage's 22 minutes -
not the transformation logic running inside it.

If shuffle volume is large relative to the actual dataset size, the question becomes: could this shuffle have been avoided (broadcast join) or reduced (filter before shuffle, select fewer columns)?

Spill (Memory) and Spill (Disk)

These two columns, often overlooked, tell you whether execution memory was sufficient for this stage.

Shuffle Spill (Memory): 4.2 GB
Shuffle Spill (Disk): 3.8 GB

Non-zero Spill (Disk) means data that should have stayed
in memory was written to and read back from local disk -
10-50x slower than an in-memory operation.
A few hundred MB of spill on a large join: normal, ignore.
Tens of GB of repeated spill: partition sizing needs fixing.

SQL Tab - The Physical Plan Doesn’t Lie

For DataFrame and SQL workloads, this tab shows exactly what Spark decided to execute — not what you wrote, what Catalyst planned.

Reading the Plan Tree

The plan reads bottom to top — the bottom nodes are data sources, the top is the final output. Each node is a physical operator: Scan, Filter, Project, Exchange, SortMergeJoin, BroadcastHashJoin, HashAggregate.

+- HashAggregate(keys=[merchant_id], functions=[sum(amount)])
+- Exchange hashpartitioning(merchant_id, 200)
+- HashAggregate(keys=[merchant_id], functions=[partial_sum(amount)])
+- Project [merchant_id, amount]
+- Filter (transaction_date >= 2026-01-01)
+- Scan parquet transactions

Read this as: scan the Parquet files, apply the date filter, select two columns, do a partial (map-side) aggregation, shuffle by merchant_id, do the final aggregation. The Exchange node is the shuffle — everything above it happened after data moved across the network, everything below happened before.

Exchange Nodes Are Shuffles

Every Exchange in the plan is a full shuffle. Count them. A query with three Exchange nodes moved data across the network three times. Reducing the number of exchanges — by restructuring joins, filtering earlier, or using bucketed tables — is often the highest-leverage optimization available.

Query with 2 sequential joins on different keys:
+- SortMergeJoin (key: customer_id)
+- Exchange hashpartitioning(customer_id)
+- SortMergeJoin (key: merchant_id)
+- Exchange hashpartitioning(merchant_id)
+- Exchange hashpartitioning(merchant_id)

Three exchanges. If the customer join could use a broadcast
instead of a shuffle, one exchange disappears entirely.

Confirming Join Strategy

Never assume which join strategy ran — confirm it here.

BroadcastHashJoin   → no shuffle on the large side, fastest
SortMergeJoin → full shuffle both sides, most expensive
ShuffledHashJoin → one shuffle, no sort — less common
BroadcastNestedLoopJoin → fallback for non-equi joins, almost always a problem

If you expected a broadcast join and see SortMergeJoin in the plan, the broadcast threshold was not met — check table size estimates and statistics freshness before anything else.


Executors Tab - Memory and GC Health

GC Time vs Task Time

This is the earliest warning sign of memory pressure — visible well before an OOM error occurs.

Executor 3: Task Time: 45min, GC Time: 6.2min (13.8%)
Executor 7: Task Time: 44min, GC Time: 0.9min (2.0%)

Executor 3 is under memory pressure relative to the others.
Above 10% GC Time / Task Time: investigate.
Above 20%: this executor is likely to fail soon
or is already dragging down the whole stage.

GC time climbing over the course of a long-running job — rather than staying flat — often indicates a memory leak pattern: objects accumulating in a UDF, state growing without bound in a streaming aggregation, or a cache that keeps growing.

Storage Memory vs Peak Execution Memory

Check these columns to understand whether your cached data and your active computation are competing for the same memory region.

Storage Memory Used: 3.2 GB / 4.0 GB allocated (80%)
Peak Execution Memory: 3.8 GB

With storage at 80% and execution peaking near the same total,
these two are actively competing. A join running concurrently
with a large cached DataFrame will likely evict cache
or spill the join - sometimes both.

Uneven Executor Load

Sort the executor list by Task Time or Shuffle Read. In a healthy job, these values are close across all executors. A significant outlier — one executor doing 5x the work of the others — points to skew that a partition-level check in the Stages tab will confirm.


Storage Tab - Is Your Cache Actually Helping

Fraction Cached

This column shows what percentage of a cached DataFrame is actually resident in memory. A value below 100% means eviction is happening — Spark is discarding cached partitions under memory pressure and recomputing them when needed again.

DataFrame: customer_features
Fraction Cached: 62%

38% of this DataFrame is not in memory. Every time
a downstream stage needs one of those partitions,
Spark recomputes it from source - silently.
The .cache() call is providing partial benefit at best.

If fraction cached is consistently low, either the DataFrame is too large for available storage memory, or too many other things are competing for the same memory region. Reducing what you cache, or increasing spark.memory.storageFraction, are the two levers.

Size in Memory vs Size on Disk

Size in Memory: 1.8 GB
Size on Disk: 2.4 GB

Data appearing in "Size on Disk" for a cache configured as
MEMORY_ONLY means Spark evicted it rather than recomputing -
if using MEMORY_AND_DISK, this is expected behavior.
If using MEMORY_ONLY, "Size on Disk" should always be zero -
any value here means partitions were dropped, not spilled,
and will be recomputed from source on next access.

The Five-Minute Health Check

When a job is slow or intermittently failing and you don’t yet have a hypothesis, this sequence covers the highest-value checks in order:

1. Jobs tab — any gap between jobs longer than a few seconds? 
→ driver-side planning cost, check logs for that window
2. Stages tab — sort by duration, open the slowest stage
→ check task duration spread (skew) and shuffle volume
3. Stages tab — check Shuffle Spill (Disk) for that stage
→ non-trivial spill means partition sizing needs fixing
4. SQL tab — confirm the join strategy matches what you expected
→ unexpected SortMergeJoin means broadcast threshold wasn't met
5. Executors tab — check GC Time / Task Time across all executors
→ uneven values point to a specific problem executor
6. Storage tab — if caching is used, check Fraction Cached
→ below 100% means the cache is providing partial value

Most production Spark performance problems are correctly diagnosed within these six checks, before reading a single line of application code.


Final Takeaway

The Spark UI is not a monitoring dashboard you check when things are already broken. It is the fastest debugging tool available for Spark jobs — faster than reading code, faster than adding print statements, faster than guessing at configuration changes.

Every number in every tab answers a specific question. Knowing which tab answers which question is the difference between a two-day debugging session and a five-minute diagnosis.

📌 Core Principle

The Spark UI already knows why your job is slow.
It is not hiding the answer.
It is waiting for you to look in the right tab.

🔥 Next in Series

🎯Building Data Quality Checks That Actually Catch Failures

Your Spark jobs run efficiently and you can debug them fast when they don’t.

Next: the data quality checks that catch the failures that cost three weeks of bad dashboards — not the obvious null checks, but row count validation patterns, distribution drift detection, and schema validation that actually prevents silent corruption from reaching production.