The OS Layer

Every tool so far reads the JVM from inside: its stderr, its collector, its stacks, its task metrics. Some failures happen underneath it. The kernel can kill the process, a disk can saturate while the JVM sees only slow writes, and a network card can drop packets that TCP resends without the JVM ever knowing. For those, the UI shows a symptom with no cause, and the evidence is on the worker.

The UI's numbers come from the JVM. Below the container boundary, only the worker's own tools report.
  • Spark UI (consumer, task and executor metrics)
  • Executor JVM (transform, heap, GC, stderr)
  • Container limit (quality gate, heap + overhead + native)
  • Kernel (custom, OOM killer, page cache, swap)
  • Local disks (storage, shuffle and spill files)
  • Network card (queue, shuffle fetch, heartbeats)
  • Executor JVM -> Spark UI
  • Executor JVM -> Container limit
  • Container limit -> Kernel
  • Kernel -> Local disks
  • Kernel -> Network card
  • Spark sees: Executor JVM, Spark UI
  • Only the OS sees: Container limit, Kernel, Local disks, Network card

The kill the JVM never logs

An executor killed with SIGKILL writes nothing on the way out, so its stderr stops mid-line with no stack trace or shutdown message. Its exit code is 137, which is 128 plus signal 9. The signal comes from the container's memory limit, which counts heap, memoryOverhead and native allocations together, or from the kernel's OOM killer when the whole worker runs short. A cgroup limit or the OOM killer leaves its record in the kernel log; a cluster manager that polls memory and kills on its own writes to its node log instead.

On the worker, run dmesg -T | grep -i -E 'killed process|out of memory' and look for a line such as Memory cgroup out of memory: Killed process 51877 (java) total-vm:21458712kB, anon-rss:18450432kB. The anon-rss figure is what the process held when it died: 18,018 MB. A 16 GB heap with the default 10% overhead sets an 18,022 MB limit, and the kernel kills the process as it reaches that limit, so anon-rss lands at the limit and never past it. The heap holds at most 16,384 MB, so native memory took at least the other 1,634 MB, filled the 1,638 MB of overhead and still asked for more. Raise spark.executor.memoryOverhead to 3 GB for headroom, then check that the kills stop.

Executor 11 on worker 10.0.4.38 disappears with exit code 137. Its stderr ends mid-line with no exception, and its GC log's last after-value was 6.1 GB of a 12 GB heap. Where do you look next, and what do you expect to find?

Disk, memory and network saturation

Symptom in SparkCheck on the workerSaturated looks like
Exit 137, stderr cut off, no Java error`dmesg -T``Killed process ... (java)` at the exit time
Tasks slow, GC low, CPU idle`vmstat 5`, then `iostat -x 5`High `wa`; `w_await` in tens of ms on the spill disk
GC pauses jump from milliseconds to seconds`vmstat 5`Nonzero `si` and `so`: the heap is swapping
High Shuffle Read Blocked Time`sar -n DEV 5`, `nstat`Receive rate near link speed, or retransmits climbing
`No space left on device``df -h` on each `spark.local.dir`A local directory at 100%

A worker during a slow shuffle stage

rbsisoussyidwa
31100944938
21200844543
312001054045

The worker has 16 cores. The b column counts processes blocked in uninterruptible I/O, 11 to 12 here, while user CPU stays between 8% and 10% and wa, the time CPUs sat idle waiting on I/O, climbs from 38% to 45%. With si and so at zero, memory is fine. The executors are ready to work and the disks hold them back: the shuffle and spill files under spark.local.dir are the bottleneck, and iostat -x 5 names the device. Spread spark.local.dir across every local disk as a comma-separated list, or cut the bytes written with the shuffle and spill fixes from earlier sections.

Network saturation surfaces as Shuffle Read Blocked Time, the stage page's measure of how long tasks waited on remote blocks. sar -n DEV 5 prints receive and transmit rates per interface, and a 10 Gb/s link tops out near 1,250 MB/s. If the rate sits well below that while blocked time stays high, run nstat twice and compare TcpRetransSegs: a count rising by thousands per interval means packets are being lost and resent.

A shuffle stage is slow. On a worker, vmstat 5 shows wa at 2% and id at 70%, sar -n DEV 5 shows 410 MB/s received on a 10 Gb/s link, and TcpRetransSegs in nstat rises by 9,000 per interval. What limits the stage?

About this lesson

This section is part of the The Spark UI: Advanced 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.