The method
-
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.
-
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.
-
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.
-
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.
-
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.
-
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
-
G1 garbage collector flag. Already the default since Spark 4.0, which runs on JDK 17.
-
Turning on adaptive query execution. Already on by default since Spark 3.2.
-
“Always 5 cores per executor” and “keep one core for the OS”. Neither is in the Spark
documentation. The tool uses a 2 to 5 convention for cores and says so; you can hold cores back yourself
under Cluster, More.
-
Driver memory copied from executor memory. Nothing in the docs supports it. The driver stays
at the value you set.
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
Spark tuning guide
Source on GitHub
Report a problem
Built by Jerome Rajan