Skip to main content
InterviewHubPRO
Section Overview
Q40

Question 40 of 50

Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

80%
Apache Spark Big Data (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

Memory Management Architecture: Storage Memory vs Execution Memory, memory fractions, and off-heap memory.

senior LevelMost AskedState ManagementMemory ManagementSystem Design

In Simple Words: Spark divides executor JVM heap into distinct pools:

  1. Reserved Memory (300 MB): Reserved for Spark internal engine processes.
  2. Spark Memory (spark.memory.fraction = 0.6): The remaining 60% of heap is dynamically shared between:
    • Execution Memory: Used for shuffles, joins, sorts, and aggregations.
    • Storage Memory: Used for cached DataFrames (df.cache()) and broadcast variables.
    • Dynamic Borrowing: Execution can evict Storage memory if needed. Storage cannot evict Execution memory.
  3. User Memory (40%): User data structures, UDF allocations, and internal metadata.