Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing
Back
  1. System Design

System design interview

Handle Data Skew in Spark Join

MediumPro55 min read

One user_id has 90% of transactions - fix Spark join skew with salting, broadcast joins, and AQE.

system-designsparkskewperformance

Interview room

One user_id has 90% of transactions. Handle Spark join skew with salting, broadcast, AQE. Diagnose first.

Basics

Skew = uneven partition work. UI straggler signature. Joins co-locate keys. Broadcast small side. Salt hot keys. AQE may split skew partitions.

Prompt

Explain stragglers; salt; broadcast; AQE; measure; celebrity vs null.

Good

UI story; histogram; choose strategy; verify.

Clarify/scope

Other side size; null vs celebrity; Spark AQE version.

Scoring lens: Handle Data Skew in Spark Join

Interviewers reward incident-first teaching, a clear control loop, and named owners. Tool logos without that loop score poorly.

Weak vs strong answers on Handle Data Skew in Spark Join

Weak: list products. Strong: tell the failure story, define the mechanism, draw the path, state rollout and monitors.

Scope control

Say what is out of scope for v1. Come back only if follow-ups demand it. This is a seniority signal for Handle Data Skew in Spark Join.

Clarifying then committing

Ask a few high-use questions about SLAs, owners, and scale, then sketch. Endless questions without a diagram look evasive.

Verification checklist

After mitigation: task duration histogram flattens, max task time drops, spill does not explode, output counts match a sampled pre-fix baseline. Without verification, salting can silently corrupt joins.

Hot-key isolation pattern

Filter the top K keys into a dedicated path with more parallelism or a different join strategy, union with the normal path. Useful when a tiny key set dominates.

Null bucket specialty

If nulls are 40% of keys, salting nulls or separating null processing is mandatory. Treating null as one key is a classic interview miss.

Interview framing detail 1

For lb-sd-31, spend the first minutes making the problem concrete: who gets hurt when this fails, what SLA is implied, and what is explicitly out of scope. Then teach the prerequisite concept before proposing boxes. A candidate who names vendors first usually loses the plot. Write two clarifying questions on the board and answer them with assumptions if the interviewer shrugs. Keep the first diagram small enough to redraw when a follow-up changes a constraint.

Interview framing detail 2

For lb-sd-31, spend the first minutes making the problem concrete: who gets hurt when this fails, what SLA is implied, and what is explicitly out of scope. Then teach the prerequisite concept before proposing boxes. A candidate who names vendors first usually loses the plot. Write two clarifying questions on the board and answer them with assumptions if the interviewer shrugs. Keep the first diagram small enough to redraw when a follow-up changes a constraint.

Interview framing detail 3

For lb-sd-31, spend the first minutes making the problem concrete: who gets hurt when this fails, what SLA is implied, and what is explicitly out of scope. Then teach the prerequisite concept before proposing boxes. A candidate who names vendors first usually loses the plot. Write two clarifying questions on the board and answer them with assumptions if the interviewer shrugs. Keep the first diagram small enough to redraw when a follow-up changes a constraint.

Interview framing detail 4

For lb-sd-31, spend the first minutes making the problem concrete: who gets hurt when this fails, what SLA is implied, and what is explicitly out of scope. Then teach the prerequisite concept before proposing boxes. A candidate who names vendors first usually loses the plot. Write two clarifying questions on the board and answer them with assumptions if the interviewer shrugs. Keep the first diagram small enough to redraw when a follow-up changes a constraint.

Interview framing detail 5

For lb-sd-31, spend the first minutes making the problem concrete: who gets hurt when this fails, what SLA is implied, and what is explicitly out of scope. Then teach the prerequisite concept before proposing boxes. A candidate who names vendors first usually loses the plot. Write two clarifying questions on the board and answer them with assumptions if the interviewer shrugs. Keep the first diagram small enough to redraw when a follow-up changes a constraint.