Spill: When the Shuffle Runs Out of Memory
Both halves of a shuffle want to work in memory, but memory is finite, and when a task needs more than it has, it spills to disk. Spill is a word to recognise in shuffle tuning, because any spill signals a task fighting for memory, and disk is far slower than the memory it wanted. A job that spills is doing extra disk work it would not have to do if its partitions were sized to fit. Spill happens most visibly during the sort on the write side and the combine on the read side. If a reduce task fetches more data for its partition than fits in its execution memory, it cannot hold it all to aggregate, so it writes some out to disk, processes what fits, and reads the spilled portion back later. The result is correct, but the task has now paid to write and re-read data that it hoped to keep in m
About This Interactive Section
This section is part of the Inside the Shuffle lesson on DataDriven, a free data engineering interview prep platform. Each section includes explanations, worked examples, and hands-on code challenges that execute in real time. SQL queries run against a live PostgreSQL database. Python runs in a sandboxed Docker container. Data modeling problems validate against interactive schema canvases. All content is framed around what data engineering interviewers actually test at companies like Meta, Google, Amazon, Netflix, Stripe, and Databricks.
How DataDriven Lessons Work
DataDriven combines four interview rounds (SQL, Python, Data Modeling, Pipeline Architecture) with adaptive difficulty and spaced repetition. Easy problems get harder as you improve. Weak concepts resurface until you master them. Your readiness score tracks progress across every topic interviewers test. Every lesson section ends with problems you solve by writing and running real code, not by picking multiple-choice answers.