Apache Spark Big Data (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
How do you calculate optimal Spark Executor Sizing for a cluster?
senior Levelapache-sparkAdvanced Internals
In Simple Words: Assume a 6-node worker node cluster with 16 cores and 64 GB RAM per node:
- Cores per Executor: Set to 5 cores (ideal balance for HDFS/S3 throughput and GC overhead).
- Executors per Node: (16 - 1 OS core) / 5 = 3 Executors per node. Total = 18 Executors.
- Reserve 1 Executor for the Driver -> 17 worker Executors.
- RAM per Executor: (64 - 1 OS RAM) / 3 ≈ 21 GB.
- Memory Overhead (
spark.executor.memoryOverhead): ~10% ≈ 2 GB. - Executor Heap (
spark.executor.memory): 21 - 2 = 19 GB.
- Memory Overhead (