Spark Config Calculator

Size your Spark executors

How it works

The method

  1. What a node can give. Use the real limit from your cluster if you have it. Until then the tool assumes 75% of node memory, the most the Spark docs suggest giving to Spark.
  2. Executors per node. Cores a node offers, divided by cores per executor. The plan always keeps one task per core. Whether YARN holds other jobs to that depends on its resource calculator: counting memory only, it keeps adding executors until the memory is gone. The tool shows what YARN would allow, and says which way of counting suits the workload you describe.
  3. Room for each executor. Node memory divided by executors per node. On YARN this is rounded down to a multiple of the container step, because YARN rounds every request up to one.
  4. The heap. A container holds the heap, the non-heap overhead (10% of the heap, at least 384 MB), plus any off-heap and Python memory. The tool picks the largest heap that still fits.
  5. The driver’s seat. One node also holds the driver, or on YARN in client mode a small Application Master. That node gets fewer executors.
  6. Inside the heap. Spark sets 300 MB aside, gives 60% of the rest to execution and storage, and protects half of that for cached data.

On Google Cloud

“Google Cloud” means Managed Service for Apache Spark on clusters, the product that was called Dataproc. It runs YARN, so the method above applies. Three things differ. Executors scale with load unless you switch that off. Shuffles start at 1000 partitions. And the YARN limits of a node are fixed when the cluster is created, so a job can only change Spark settings. The serverless service is not covered: it has no nodes to size.

Does the workload fit?

With a data size, the page compares what the largest task needs with what a task is sure of and the most it can take. It counts how many times the cluster must fill with tasks to read the data. It gives a time only if you enter a task time you measured, because nothing in the documentation predicts one. It does not give a chance of running out of memory: that depends on the query, and any number would be invented.

Left out on purpose

What it cannot know

How much memory a job needs depends on its data and its queries. The docs’ own advice is to measure: cache a sample and read its size on the Storage page of the Spark UI. Treat these numbers as a sound first run, then adjust from what the UI shows.

Terms, in plain words