PrepCity

Broadcast or shuffle?

Open the lab

By the last page, this is the design you will have built. Drag it, or Show all, to see every part.

Lesson · 5 pages · about 4 min

Broadcast or shuffle?

Spark joins a small table by copying it to every executor, and a big one by shuffling both sides. Measured: the default threshold that misses a small table, and the broadcast that runs out of memory.

What it is
The two ways Spark joins two tables: copy the small one to every machine (broadcast), or send both tables’ rows across the network by key (shuffle).
What it is for
Joins are where big jobs spend their time. The right choice turns minutes of moving data into almost none, or stops the job crashing.
Use it when
Every time a job joins a big table with another one: check the smaller table’s size at production scale, not on test data.

Words you’ll learn

  • Spark
  • Broadcast join
  • Shuffle
  • Join
  • Driver
  • Executor
  • Retry

Page by page