Apache Spark Big Data (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
Spark Executor Sizing Rules of Thumb: Cores, Memory, and Overhead.
senior Levelapache-sparkAdvanced Internals
In Simple Words: Production best-practice executor sizing formulas:
- Cores per Executor: Keep between 4 and 5 cores (
spark.executor.cores = 5).- $> 5$ cores leads to JVM Garbage Collection thrashing.
- 1 core per executor wastes shared broadcast memory.
- Executor Overhead Memory (
spark.executor.memoryOverhead):- Calculated as
max(384MB, 10% of executor.memory). - Allocate 15-20% if using heavy PySpark Arrow operations or off-heap shuffles.
- Calculated as
- Leave 1 Core and 1GB RAM per Node for OS kernel and container runtime daemons.