Skip to main content
InterviewHubPRO
Section Overview
Q19

Question 19 of 50

Part 2: Core Architecture & Implementation (Mid-Level)

38%
Apache Spark Big Data (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)

What is Data Skew in Apache Spark and how do you resolve it?

senior LevelSystem Design

In Simple Words: Data skew occurs when one partition contains disproportionately more records than others (e.g. 90% of orders belong to country = 'US'):

  • Symptom: One task in a stage runs for 45 minutes while all other 199 tasks finish in 10 seconds!
  • Solutions:
    1. Salting: Append a random integer (e.g. key_0 to key_9) to the join key to distribute the skewed key across 10 partitions, joining against a replicated lookup table.
    2. Enable Adaptive Query Execution (AQE) skew join handling.