Reading Memory in the UI
Each region from this lesson leaves a trace in the Spark UI, spread across 3 places: the Executors tab, the Storage tab, and the detail page for each stage. Walking them in that order narrows a memory problem to a single region.
Executors tab: unified memory per executor
Each executor gets a row. Storage Memory reads as used over total, for example 2.3 GiB / 4.4 GiB. The total is the whole unified region, since storage may borrow all of it, and it lands a little below the formula's 4,735 MB (4.6 GiB) because the JVM reports slightly less heap than it was given. Disk Used counts cached blocks held on local disk. Among the tab's additional metrics, Peak JVM Memory shows the most heap the process ever used. Task Time (GC Time) turns red when garbage collection takes more than 10% of task time, a sign the heap is crowded with live objects.
Storage tab: what survived in the cache
Each cached DataFrame gets a row, with its Storage Level, Cached Partitions, Fraction Cached, Size in Memory and Size on Disk. Under MEMORY_ONLY, evicted partitions leave the cache, so Fraction Cached falls below 100%. Under a memory-and-disk level, they move from Size in Memory to Size on Disk, and Fraction Cached can stay at 100% while the cache quietly slows down.
Stage page: execution memory per task
Open the slowest stage. Its summary metrics give Peak Execution Memory, Spill (Memory) and Spill (Disk) as quantiles, and its task table lists failed tasks with their error, which is where ExecutorLostFailure shows up.
From symptom to region
| What you see | Region under pressure | First move |
|---|---|---|
| Spill on most tasks, peaks near each task's share | Execution, in unified memory | More shuffle partitions, or fewer cores per executor |
| Spill on the max task only | Execution, from skewed input | Salt or isolate the hot key |
| Fraction Cached below 100%, or Size on Disk climbing during joins | Storage, in unified memory | Cache fewer columns, or unpersist sooner |
| `java.lang.OutOfMemoryError: Java heap space` in an executor log | User memory, or the heap as a whole | Less data per task, or more heap |
| `ExecutorLostFailure`, exit code 137, no heap error | Overhead, outside the heap | Raise `spark.executor.memoryOverhead` |
| GC Time in red | Heap crowded with live objects | Check cache size and per-task data first |
A report reads a DataFrame persisted with MEMORY_ONLY, after a large join ran on the same executors. Which reading tells you whether part of that DataFrame had to be recomputed?
- Fraction Cached below 100% in the Storage tab
- Disk Used above zero in the Executors tab
- Spill (Disk) above zero on the join's stage
- Peak JVM Memory close to the full heap
Putting the readings together
A job caches trips_enriched with cache() on the running-example executors, then runs a heavy aggregation over it. No task fails. Mid-stage, the Executors tab and the stage's summary metrics read as follows.
Which reading of these numbers is right, and what is the first move?
- Overhead is running out, so raise spark.executor.memoryOverhead before the next run.
- A hot key is overloading one task, so salt it to spread its rows across tasks.
- The cache sits at its protected half, capping each task near 563 MiB, so shrink or unpersist it.
- User memory is full, so lower spark.memory.fraction to give your own objects room.
About this lesson
This section is part of the Memory and Caching: Intermediate lesson on DataDriven, the home of data engineering. Lessons cover SQL, Python, Spark, data modeling and pipeline architecture, and each section pairs its explanation with worked examples and practice you run as you go.