Skip to content
About
Main content

Summary and key takeaways

The three idlenesses

IdlenessWaiting forTypical cureWhat the cure costs
DependencyThe producerBuffers, pipelining, batchingMemory (: items in flight = rate × time)
ImbalanceThe slowest peer at a Smaller units, stealing, splitting, speculationDispatch overhead, duplicate work
ExclusionA shared resourcePartitioning, An O(M × R) edge count

The two numbers to carry. Bytes per shuffle connection b = S / (M × R), compared with the substrate's . And the barrier penalty /E[mean] ≈ 1 + c·√(2 ln n), paid again in every round.

Mateo and Hana's lessons, in order:

  1. The idle dashboard (Three idlenesses). An optimal plan can still leave 75% of the cores idle. Name which idleness dominates before buying machines.
  2. The 40× slower loop (Inside one worker). Cost sits at boundaries (a call per ). Direction (pull or push), granularity (tuple, batch, stage) and form (interpreted or compiled) are independent choices. Batch about L1 ÷ row width, about 1,024. Compilation breaks even at 50 ms ÷ 20 ns = 2.5 million tuples.
  3. The failing nightly job (Across machines). Across machines a task must last at least about 1 s (10 ms dispatch, 1% target). decides stream or materialize. pays the penalty every ; actors need bounded mailboxes; is priced in requests.
  4. Doubling the cluster (Where parallelism comes from). T_p ≥ max(T₁/p, T∞). The largest caps speedup at 1/f, and under Zipf-1 that is about ln(distinct keys). define stages; decomposability gates ; reaches the bound but cannot split a task; speculation helps stragglers only when the cluster has room.
  5. The 7% key (Skew and elasticity). Classify (duration against bytes) before choosing a fix. needs the unit split: , adaptive splitting, . Join skew multiplies (L × R). Elasticity is limited by work ÷ minimum task, and mid-query scale-out pays only when remaining work ≫ acquisition .
  6. Too many open files (The shuffle). A shuffle is a distributed transpose. M = R ≤ √(S/b_min). replaces R files with R offsets; consolidation collapses the M axis; push-based and remote services merge across producers (and win mainly through elasticity); trees need associativity; when R × S_small < S_large.
  7. The faster network (The shuffle). Compress only if C > BW × r/(r−1); serialize as a copy of the engine's own format; must be deterministic; immutable shuffle output needs a registry and a cleaner that keeps up.

Decision procedures in one table:

QuestionFirst checkRule
Why is speedup flat?Largest partition share fCeiling is 1/f; stop buying cores there
Which fix for the long tail?Duration against bytes scatterSpread: finer tasks or stealing. One slow task: speculate. Duration ∝ bytes: split the unit
Static or ?Are stage edges streamed?Streamed means static; materialized allows per-stage adaptation
How small can tasks be? FMinimum duration = F ÷ overhead target (1 s), at least 10 tasks per worker
Is speculation safe?, determinism, detectorIdle capacity, deterministic tasks, remaining-time estimate
How wide can a shuffle be?b against b_minM = R ≤ √(S/b_min); reduce S before changing topology
Which shuffle format?R and consumer needsSmall R: hash bypass. Large R: sort. Sorted consumer: sort by key on the map side
Compress shuffle data?Link speed and codec speedOnly if C > BW × r/(r−1)
Retries and speculation allowed?Partition functionVerify determinism first

Patterns that repeat:

  • per operation gives a natural unit size: batch size, compile break-even, size, task size, shuffle fragment size.
  • Granularity mismatch amplifies work, and : no mechanism corrects below the unit it schedules. Skew splitting even depended on a file format choice.
  • Costs are moved, not removed. bills memory, sort shuffle bills a cheap counting pass, bills a third party and a second hop.
  • Variance costs more than volume. Barriers turn variance into latency.
  • Queues explode near full load, which is why speculation turns negative when the cluster is busy.
  • Uniformity is assumed and false. Partitioners assume even keys; Zipf turns that into a closed-form ceiling.
  • Randomization can replace coordination (work stealing, with a proof).
  • Algebra gates topology. Only reductions can be combined in parts, in trees or before a shuffle.
  • Immutable output grows an indirection layer plus a garbage collector (the and the cleaner).
  • is . Whoever decides when the next unit moves is the only one who can refuse it: pull gets free, push must build it.

Key formulas and numbers:

QuantityValue
T_p ≥ max(T₁/p, T∞)
Data-parallel ceiling1/f; Zipf-1: 1/H_n, H_n ≈ ln n + 0.577 (about 14 at 10⁶ keys, about 21 at 10⁹)
Minimum task durationF ÷ overhead target: 10 ms ÷ 1% = 1 s
Elasticity ceilingtotal_work / (10 × min_task) workers
b = S / (M × R)
Width ceilingM = R ≤ √(S/b_min): 100 GB about 316; 1 TB 1000; 10 TB about 3162
1 + ⌈log_k(S_task/B)⌉: three passes at ratio 1000 and k = 64
Hash shuffle bufferscores × R × buffer: 16 × 1000 × 32 KB = 512 MB
Broadcast threshold(R − 1) × S_small < S_large
Compression ruleC > BW × r/(r−1)
Object-store request cost$5 / (10⁶ × object size in GB): $0.05 per GB at 100 KB
Streaming vs materializingn × T × λ against 1

What the runtime cannot do. It cannot know how long a piece of work will take before it runs. It cannot correct an imbalance smaller than the unit it schedules, or split a unit that is too big by moving it. It cannot parallelize an whose algebra is not decomposable. It cannot make a transpose cheap: the shuffle only chooses who pays. Every escape has a price, paid in memory, duplicate work, a second network hop, a stateful service or lost determinism.