← Tutorials/When to Use Broadcast Joins and How Spark DecidesIntermediate
▶ 8 min9.1k views
Apache SparkApache Spark

When to Use Broadcast Joins and How Spark Decides

Broadcast joins send the smaller table to every executor, eliminating the shuffle entirely. Learn the auto-broadcast threshold, how to force or disable it, and what Spark UI tells you when a broadcast goes wrong.

Animated Explanation
STEP 1 / 5
1

Spark broadcasts the smaller DataFrame to every executor node using TorrentBroadcast — a peer-to-peer protocol that avoids driver bottleneck. Each executor caches the broadcast table in memory and applies it to local partitions of the large table.

Key Concepts
Broadcast variableautoBroadcastJoinThresholdSort-merge vs broadcastDriver memory
🎯 You'll Learn

Choose the right join strategy and avoid OOM on large broadcasts

📋 Prerequisites

Spark joins basics