Interview's MateData Engineer
Interview's Mate

Data Engineer

SQL · Spark · Lakehouse · Streaming

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Data Engineer topics
Lesson 76/ 160
04. Big Data Processing & Apache Spark

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.

AdvancedSpark UI · Spill · Shuffle3 quiz questions
Practice Generative AI Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

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

Loading interactive 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.

Reading Spark UI in one concrete design

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.

Key takeaway: 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

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.

Key takeaway: 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.

How it works, step by step

Step 1 of 4
Spark UI

1. 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.

match user query to action and job IDs
Key numbers at this step
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

Spark UI
Best for: Spark's web interface for live/completed application SQL, DAG, jobs, stages, storage, executors, and environment.

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.

Spill
Best for: Execution state serialized to local/disk because memory could not retain a sort or hash structure.

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.

Shuffle
Best for: Bytes written to and read from shuffle service or local blocks during cross-partition exchanges.

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?
Interview tip: Lead with the data path and failure boundary: 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. Then make the answer operational: 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.

Knowledge check

Loading quiz

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.

Open Data Engineer Q&A →Machine Learning Q&A
Previous topic
Caching, Persistence Levels & Memory Management (OOM Debugging)
Next topic
Structured Streaming with PySpark (Micro-Batching, Triggers, Checkpointing)