ExitBroadcast Joins: small-input replication in Spark1 / 9
Explanation

Move the small input, not the large one

How replicating a small join input avoids shuffling the larger input, and how to select and verify this strategy using input sizes, worker memory, and Spark execution plans. · associate

A join needs matching keys to meet. A shuffle join can repartition both inputs by the join key, moving rows between workers. A broadcast join instead replicates one input to the participating executors, the Spark processes that run tasks. Each executor can then join its existing partitions of the other input locally.

For a supported equality join, Spark can use a broadcast hash join. The small input is the build side: Spark builds an in-memory hash table from it. Tasks scan partitions of the large probe side and look up matching keys. For example, broadcasting a country-code reference table avoids redistributing a large event dataset by country. Broadcasting still transfers data; it avoids the larger input's join-key shuffle, not every network transfer or every shuffle in the query.

This can also avoid concentrating a frequent join key in one shuffled partition. It does not rebalance partitions that were already oversized or fix skew in a later aggregation. The benefit depends on the large input already having reasonably balanced partitions.

PropertyShuffle joinBroadcast hash join
Data movementRepartition by join keyReplicate build input
Large inputMay move between workersProbe existing partitions
Small inputPartitioned for matchingComplete local lookup
Main concernShuffle cost and skewReplicated memory use