<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://openlakehouse.io/w/index.php?action=history&amp;feed=atom&amp;title=Executor_memory_overhead</id>
	<title>Executor memory overhead - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://openlakehouse.io/w/index.php?action=history&amp;feed=atom&amp;title=Executor_memory_overhead"/>
	<link rel="alternate" type="text/html" href="https://openlakehouse.io/w/index.php?title=Executor_memory_overhead&amp;action=history"/>
	<updated>2026-12-06T00:07:34Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://openlakehouse.io/w/index.php?title=Executor_memory_overhead&amp;diff=147&amp;oldid=prev</id>
		<title>Open Lakehouse Wiki sync: Sync from open-lakehouse/wiki@7c9abaa</title>
		<link rel="alternate" type="text/html" href="https://openlakehouse.io/w/index.php?title=Executor_memory_overhead&amp;diff=147&amp;oldid=prev"/>
		<updated>2026-11-25T00:52:41Z</updated>

		<summary type="html">&lt;p&gt;Sync from open-lakehouse/wiki@7c9abaa&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Infobox concept&lt;br /&gt;
| name            = Executor memory overhead&lt;br /&gt;
| also_known_as   = &amp;lt;code&amp;gt;spark.executor.memoryOverhead&amp;lt;/code&amp;gt;, memory overhead, non-heap memory&lt;br /&gt;
| field           = Distributed data processing&lt;br /&gt;
| key_parts       = JVM native memory, Python workers, other processes in the container, container memory limit&lt;br /&gt;
| implementations = [[Apache Spark]] on YARN and Kubernetes&lt;br /&gt;
| related         = [[Spark memory management]], [[Executor]], [[Garbage collection in Spark]]&lt;br /&gt;
}}&lt;br /&gt;
{{Verified|2026-11-23|the v4.3.0 tag of apache/spark (docs/configuration.md, docs/running-on-kubernetes.md, docs/running-on-yarn.md), Hadoop yarn-default.xml (stable docs) and the Kubernetes &amp;quot;Assign Memory Resources to Containers&amp;quot; task page}}&lt;br /&gt;
&lt;br /&gt;
In [[Apache Spark]], &amp;#039;&amp;#039;&amp;#039;executor memory overhead&amp;#039;&amp;#039;&amp;#039; is the memory that Spark requests for each [[executor]] container on top of the JVM heap, to cover everything in the container that is not on the heap: JVM internals, native libraries, Python worker processes and other processes. It is set by &amp;lt;code&amp;gt;spark.executor.memoryOverhead&amp;lt;/code&amp;gt; and applies on YARN and Kubernetes.&amp;lt;ref name=&amp;quot;config&amp;quot;&amp;gt;{{Cite web |url=https://spark.apache.org/docs/4.3.0/configuration.html |title=Spark Configuration (Spark 4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-23}}&amp;lt;/ref&amp;gt; When the executor process as a whole uses more memory than its container allows, the cluster manager kills the container, even if the JVM heap still has room.&lt;br /&gt;
&lt;br /&gt;
== How is memory overhead sized? ==&lt;br /&gt;
By default, &amp;lt;code&amp;gt;spark.executor.memoryOverhead&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;spark.executor.memory&amp;lt;/code&amp;gt; × &amp;lt;code&amp;gt;spark.executor.memoryOverheadFactor&amp;lt;/code&amp;gt;, with a minimum of &amp;lt;code&amp;gt;spark.executor.minMemoryOverhead&amp;lt;/code&amp;gt;.&amp;lt;ref name=&amp;quot;config&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Setting !! Default !! Since&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spark.executor.memoryOverhead&amp;lt;/code&amp;gt;&lt;br /&gt;
| executor memory × factor, at least the minimum&lt;br /&gt;
| 2.3.0&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spark.executor.memoryOverheadFactor&amp;lt;/code&amp;gt;&lt;br /&gt;
| 0.10; 0.40 for non-JVM jobs on Kubernetes&lt;br /&gt;
| 3.3.0&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spark.executor.minMemoryOverhead&amp;lt;/code&amp;gt;&lt;br /&gt;
| 384 MiB&lt;br /&gt;
| 4.0.0&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;small&amp;gt;Source: Spark 4.3.0 configuration reference.&amp;lt;ref name=&amp;quot;config&amp;quot; /&amp;gt;&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full container size is the sum of &amp;lt;code&amp;gt;spark.executor.memory&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;spark.executor.memoryOverhead&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;spark.memory.offHeap.size&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;spark.executor.pyspark.memory&amp;lt;/code&amp;gt;.&amp;lt;ref name=&amp;quot;config&amp;quot; /&amp;gt; An executor with &amp;lt;code&amp;gt;spark.executor.memory=8g&amp;lt;/code&amp;gt; and no other settings gets about 819 MiB of overhead, so a container of about 9 GiB. The higher factor for non-JVM jobs on Kubernetes exists because, in the words of the Spark docs, such tasks &amp;quot;commonly fail with &amp;#039;Memory Overhead Exceeded&amp;#039; errors&amp;quot;.&amp;lt;ref name=&amp;quot;config&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== What lives outside the JVM heap? ==&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;JVM and native overheads.&amp;#039;&amp;#039;&amp;#039; The Spark docs list VM overheads, interned strings and other native overheads.&amp;lt;ref name=&amp;quot;config&amp;quot; /&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Python workers.&amp;#039;&amp;#039;&amp;#039; In PySpark, Python worker processes run beside the executor JVM in the same container. Their memory is counted in the overhead unless &amp;lt;code&amp;gt;spark.executor.pyspark.memory&amp;lt;/code&amp;gt; is set, in which case it is a separate, limited amount added to the container request.&amp;lt;ref name=&amp;quot;config&amp;quot; /&amp;gt; Python UDFs and pandas UDFs that load large objects use this memory.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Other processes in the container.&amp;#039;&amp;#039;&amp;#039; Anything else started in the executor&amp;#039;s container counts against the overhead.&amp;lt;ref name=&amp;quot;config&amp;quot; /&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;RAM-backed local directories on Kubernetes.&amp;#039;&amp;#039;&amp;#039; With &amp;lt;code&amp;gt;spark.kubernetes.local.dirs.tmpfs=true&amp;lt;/code&amp;gt;, shuffle and spill files live in memory and count toward the pod&amp;#039;s memory, so the overhead factor should be raised.&amp;lt;ref name=&amp;quot;k8s&amp;quot;&amp;gt;{{Cite web |url=https://spark.apache.org/docs/4.3.0/running-on-kubernetes.html |title=Running Spark on Kubernetes (Spark 4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Off-heap memory set with &amp;lt;code&amp;gt;spark.memory.offHeap.size&amp;lt;/code&amp;gt; is not part of the overhead; it is added to the container separately.&amp;lt;ref name=&amp;quot;config&amp;quot; /&amp;gt; See [[Spark memory management]].&lt;br /&gt;
&lt;br /&gt;
== Why do executor containers get killed? ==&lt;br /&gt;
YARN and Kubernetes both enforce the container&amp;#039;s memory limit from outside the JVM. The JVM heap cannot grow beyond &amp;lt;code&amp;gt;spark.executor.memory&amp;lt;/code&amp;gt;, but native and Python memory can, and when the process as a whole goes over the limit the container is terminated.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;On YARN&amp;#039;&amp;#039;&amp;#039;, the NodeManager enforces physical memory limits for containers by default (&amp;lt;code&amp;gt;yarn.nodemanager.pmem-check-enabled&amp;lt;/code&amp;gt;, default true).&amp;lt;ref name=&amp;quot;yarndefault&amp;quot;&amp;gt;{{Cite web |url=https://hadoop.apache.org/docs/stable/hadoop-yarn/hadoop-yarn-common/yarn-default.xml |title=yarn-default.xml |publisher=Apache Software Foundation |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;On Kubernetes&amp;#039;&amp;#039;&amp;#039;, a container that allocates more memory than its limit becomes a candidate for termination; the pod status then shows &amp;lt;code&amp;gt;OOMKilled&amp;lt;/code&amp;gt; and exit code 137.&amp;lt;ref name=&amp;quot;k8smem&amp;quot;&amp;gt;{{Cite web |url=https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/ |title=Assign Memory Resources to Containers and Pods |publisher=The Kubernetes Authors |access-date=2026-11-23}}&amp;lt;/ref&amp;gt; The Spark Kubernetes docs also describe exit code 137 as a SIGKILL, possibly a container OOM, and exit code 52 as a JVM out-of-memory error.&amp;lt;ref name=&amp;quot;k8s&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A container kill and a JVM &amp;lt;code&amp;gt;OutOfMemoryError&amp;lt;/code&amp;gt; are different failures. A JVM heap OOM means the heap was too small for the task; the fix is more &amp;lt;code&amp;gt;spark.executor.memory&amp;lt;/code&amp;gt;, more partitions, or less data per task. A container kill with a healthy heap means the non-heap side was too small; the fix is more overhead, setting &amp;lt;code&amp;gt;spark.executor.pyspark.memory&amp;lt;/code&amp;gt;, or reducing native or Python memory use. On YARN, Spark 4.3.0 adds &amp;lt;code&amp;gt;-XX:OnOutOfMemoryError=&amp;#039;kill %p&amp;#039;&amp;lt;/code&amp;gt; to executor JVM options by default (&amp;lt;code&amp;gt;spark.yarn.executor.oomKill.enabled&amp;lt;/code&amp;gt;), so a heap OOM also ends the executor process.&amp;lt;ref name=&amp;quot;yarn&amp;quot;&amp;gt;{{Cite web |url=https://spark.apache.org/docs/4.3.0/running-on-yarn.html |title=Running Spark on YARN (Spark 4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Spark 4.3.0 on Kubernetes can also react to these failures with &amp;lt;code&amp;gt;org.apache.spark.scheduler.cluster.k8s.ExecutorResizePlugin&amp;lt;/code&amp;gt;, which is enabled by registering it in &amp;lt;code&amp;gt;spark.plugins&amp;lt;/code&amp;gt;. Every &amp;lt;code&amp;gt;spark.kubernetes.executor.resizeInterval&amp;lt;/code&amp;gt;, the driver reads each executor container&amp;#039;s memory usage, and when usage exceeds &amp;lt;code&amp;gt;spark.kubernetes.executor.resizeThreshold&amp;lt;/code&amp;gt; of the current limit it raises the memory request and limit in place by &amp;lt;code&amp;gt;spark.kubernetes.executor.resizeFactor&amp;lt;/code&amp;gt;, with no configured upper bound. It requires Kubernetes 1.33 or later (in-place pod resize through the &amp;lt;code&amp;gt;pods/resize&amp;lt;/code&amp;gt; subresource), a metrics server or other provider of the &amp;lt;code&amp;gt;metrics.k8s.io&amp;lt;/code&amp;gt; API, and a driver service account allowed to list pods, get pods in the &amp;lt;code&amp;gt;metrics.k8s.io&amp;lt;/code&amp;gt; API group and patch &amp;lt;code&amp;gt;pods/resize&amp;lt;/code&amp;gt;. The heap size does not change, so the extra memory goes to off-heap and native use, and Kubernetes may reject or defer a resize when the node lacks free memory.&amp;lt;ref name=&amp;quot;k8sresize&amp;quot;&amp;gt;{{Cite web |url=https://spark.apache.org/docs/4.3.0/running-on-kubernetes.html#executor-memory-resize |title=Running Spark on Kubernetes: Executor Memory Resize (Spark 4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
spark.plugins                              org.apache.spark.scheduler.cluster.k8s.ExecutorResizePlugin&lt;br /&gt;
spark.kubernetes.executor.resizeInterval   1m&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
A PySpark job whose Python UDFs need about 2 GiB per executor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
spark.executor.memory            8g&lt;br /&gt;
spark.executor.memoryOverhead    1g&lt;br /&gt;
spark.executor.pyspark.memory    2g&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each executor container is then 11 GiB: 8 GiB heap, 1 GiB overhead and 2 GiB reserved for Python.&amp;lt;ref name=&amp;quot;config&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Spark memory management]]&lt;br /&gt;
* [[Executor]]&lt;br /&gt;
* [[Garbage collection in Spark]]&lt;br /&gt;
* [[Spill (memory)]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Navbox open lakehouse}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Concepts]]&lt;br /&gt;
[[Category:Glossary terms]]&lt;br /&gt;
[[Category:Apache Spark]]&lt;/div&gt;</summary>
		<author><name>Open Lakehouse Wiki sync</name></author>
	</entry>
</feed>