Skip to content
Gold 8 min read · spark.shuffle.service.enabled 2 practice problems ↓

Shuffle internals

Map output files, block fetches, fetch failures and the external shuffle service.

Step 2 · Spark internals · Gold · Under the hood, lesson 3 of 5

Read first: Narrow vs wide transformations · Jobs, stages and tasks (skip if you know them)

In plain words first

A shuffleshuffle: Moving rows between machines so that all rows with the same key end up together. Needed by joins, groupBy and sorting, and usually the most expensive step of a job. Learn more → is a postal sorting office. Every sender writes letters sorted by postcode into one bag with an index; every postcode's carrier then collects their letters from all the bags.

Unlock the full lesson

You have read the free part. The rest of this advanced lesson:

  • The map side: writing shuffle files
  • The reduce side: fetching blocks
  • Fetch failures
  • The external shuffle service
  • Reading shuffle metrics
  • Configs worth knowing
  • Try it yourself
  • Common mistakes
  • Key takeaways
  • Interview prep with 3 follow-up questions
  • Check yourself: 3 questions

Unlock it with the Complete pass (every advanced problem and lesson) or on its own.

Practise this

Interview problems on spark performance, graded on hidden tests

Keep going

Up next · Under the hood · lesson 4 of 5 · 7 min read
How aggregations execute
Partial and final aggregation, hash vs sort aggregation, and why COUNT(DISTINCT) costs more.

Related lessons

Previous: The memory model

Primary sources: RDD guide: shuffle operations · Configuration: shuffle behavior