Reading Spark UI (DAG Visualization, Spill to Disk, GC Time, Shuffle Read/Write)
Diagnose slow jobs from the Spark UI: stages, spill, GC, and shuffle bytes.
In plain words
Match user query to action and job IDs. Next, identify stage boundaries and scans. Finally, join key, partitioning, memory, executor, or I/O fix.
Think of it like…
The Spark UI is a pit dashboard for a race: total finish time matters, but a smoking tire, one slow pit crew, or excessive fuel transfer identifies the fix.
Where you’ve seen it
Stage 12 shows 99 tasks in 8 seconds and one in 12 minutes, 18 TB shuffle read, and 60% GC: investigate the hot key/task, not driver CPU. A 4 GB Spill (Memory) field means the hash/sort did not fit.
Words you’ll hear
- Spark UI
- Spark's web interface for live/completed application SQL, DAG, jobs, stages, storage, executors, and environment.
- Spill
- Execution state serialized to local/disk because memory could not retain a sort or hash structure.
- Shuffle
- Bytes written to and read from shuffle service or local blocks during cross-partition exchanges.
- Operational boundary
- Looking only at total job time misses one straggler, while a high shuffle write is expected for some joins but an unexpected one signals lost projection, key expansion, or a missing broadcast opportunity. Follow completed task p50/p95/max, input and shuffle bytes, executor timeline, GC, spill and failed task reasons, then open the SQL plan node and compare source/output row ratios.
Visual diagram
Theory & deep dive
Spark UI: the working mechanism
The Spark UI ties SQL/DAG visualization to jobs, stages, task distributions, shuffle read/write, spill, executor loss, and GC so an operator can identify the physical bottleneck.
Match user query to action and job IDs. Identify stage boundaries and scans, then duration, bytes, GC, spill, and locality; this exposes the state governed by Shuffle.
Stage 12 shows 99 tasks in 8 seconds and one in 12 minutes, 18 TB shuffle read, and 60% GC: investigate the hot key/task, not driver CPU. A 4 GB Spill (Memory) field means the hash/sort did not fit.
Reading Spark UI: failure mode and production response
Looking only at total job time misses one straggler, while a high shuffle write is expected for some joins but an unexpected one signals lost projection, key expansion, or a missing broadcast opportunity.
Follow completed task p50/p95/max, input and shuffle bytes, executor timeline, GC, spill and failed task reasons, then open the SQL plan node and compare source/output row ratios. Track Task p99/max as "identifies stragglers hidden by averages", and make GC time fraction visible to the dataset owner.
How it works, step by step
Step 1 of 41. Open SQL/job
Match user query to action and job IDs. The Spark UI ties SQL/DAG visualization to jobs, stages, task distributions, shuffle read/write, spill, executor loss, and GC so an operator can identify the physical bottleneck.
- Task p99/max
- identifies stragglers hidden by averages
- Spill
- Execution state serialized to local/disk because memory could not retain a sort or hash structure.
When to use it & trade-offs
What it is
The Spark UI ties SQL/DAG visualization to jobs, stages, task distributions, shuffle read/write, spill, executor loss, and GC so an operator can identify the physical bottleneck. Stage 12 shows 99 tasks in 8 seconds and one in 12 minutes, 18 TB shuffle read, and 60% GC: investigate the hot key/task, not driver CPU. A 4 GB Spill (Memory) field means the hash/sort did not fit.
Why it matters: Looking only at total job time misses one straggler, while a high shuffle write is expected for some joins but an unexpected one signals lost projection, key expansion, or a missing broadcast opportunity. Follow completed task p50/p95/max, input and shuffle bytes, executor timeline, GC, spill and failed task reasons, then open the SQL plan node and compare source/output row ratios.
When to reach for it
- Diagnose slow jobs from the Spark UI: stages, spill, GC, and shuffle bytes.
- Choose Spark UI because it provides this capability: Spark's web interface for live/completed application SQL, DAG, jobs, stages, storage, executors, and environment.
- Keep evidence for Task p99/max at "identifies stragglers hidden by averages" so the last production stage-Map cause - join key, partitioning, memory, executor, or I/O fix-remains testable.
When to avoid or be careful
- Looking only at total job time misses one straggler, while a high shuffle write is expected for some joins but an unexpected one signals lost projection, key expansion, or a missing broadcast opportunity.
- Do not conflate Spill with Spark UI. The second concept contributes different behavior: Execution state serialized to local/disk because memory could not retain a sort or hash structure.
- Release only after this guardrail is in place: Follow completed task p50/p95/max, input and shuffle bytes, executor timeline, GC, spill and failed task reasons, then open the SQL plan node and compare source/output row ratios.
Spark UI / Spill / Shuffle - roles, limits, and operating cost
Strengths: Spark's web interface for live/completed application SQL, DAG, jobs, stages, storage, executors, and environment. The Spark UI ties SQL/DAG visualization to jobs, stages, task distributions, shuffle read/write, spill, executor loss, and GC so an operator can identify the physical bottleneck.
Watch out: Looking only at total job time misses one straggler, while a high shuffle write is expected for some joins but an unexpected one signals lost projection, key expansion, or a missing broadcast opportunity.
Strengths: Execution state serialized to local/disk because memory could not retain a sort or hash structure. In this workflow it supports: Compare tasks - duration, bytes, GC, spill, and locality.
Watch out: The operating cost is real: compare to task time per executor.
Strengths: Bytes written to and read from shuffle service or local blocks during cross-partition exchanges. Its output can be checked with Shuffle read.
Watch out: Operating guardrail: Follow completed task p50/p95/max, input and shuffle bytes, executor timeline, GC, spill and failed task reasons, then open the SQL plan node and compare source/output row ratios.
Interview signals & numbers to know
When this topic comes up
- “Where is the failure boundary for Spark UI, and how would Task p99/max reveal it?”
- “Why is Spill distinct from this behavior: bytes written to and read from shuffle service or local blocks during cross-partition exchanges?”
- Production clue: Looking only at total job time misses one straggler, while a high shuffle write is expected for some joins but an unexpected one signals lost projection, key expansion, or a missing broadcast opportunity.
- Design probe: Follow completed task p50/p95/max, input and shuffle bytes, executor timeline, GC, spill and failed task reasons, then open the SQL plan node and compare source/output row ratios.
Benchmarks & rules of thumb
- Task p99/max
- identifies stragglers hidden by averages
- GC time fraction
- compare to task time per executor
- Shuffle read
- network and disk bytes after shuffle boundary
Common mistakes & follow-ups
Common interview mistakes
- Looking only at total job time misses one straggler, while a high shuffle write is expected for some joins but an unexpected one signals lost projection, key expansion, or a missing broadcast opportunity.
- Reporting success from a job exit code without checking Task p99/max and GC time fraction.
- Treating this example as complete without replay, rollback, or access boundaries: Stage 12 shows 99 tasks in 8 seconds and one in 12 minutes, 18 TB shuffle read, and 60% GC: investigate the hot key/task, not driver CPU. A 4 GB
Spill (Memory)field means the hash/sort did not fit.
Likely interviewer follow-ups
- How would you prove this contract instead of only checking that the command ran: Spark's web interface for live/completed application SQL, DAG, jobs, stages, storage, executors, and environment.
- What does the recovery plan do when this occurs? Looking only at total job time misses one straggler, while a high shuffle write is expected for some joins but an unexpected one signals lost projection, key expansion, or a missing broadcast opportunity.
- When is Spark UI insufficient for GC time fraction, and what does adding Spill cost in Task p99/max?
Knowledge check
Put it into practice
Practice related interview Q&A
Apply Reading Spark UI (DAG Visualization, Spill to Disk, GC Time, Shuffle Read/Write) with data engineer interview Q&A and hands-on practice.