Skip to main content
InterviewHubPRO
Section Overview
Q25

Question 25 of 50

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

50%
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:

  1. Cores per Executor: Set to 5 cores (ideal balance for HDFS/S3 throughput and GC overhead).
  2. Executors per Node: (16 - 1 OS core) / 5 = 3 Executors per node. Total = 18 Executors.
  3. Reserve 1 Executor for the Driver -> 17 worker Executors.
  4. 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.