<?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=Spark_History_Server</id>
	<title>Spark History Server - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://openlakehouse.io/w/index.php?action=history&amp;feed=atom&amp;title=Spark_History_Server"/>
	<link rel="alternate" type="text/html" href="https://openlakehouse.io/w/index.php?title=Spark_History_Server&amp;action=history"/>
	<updated>2026-12-06T00:29:44Z</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=Spark_History_Server&amp;diff=187&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=Spark_History_Server&amp;diff=187&amp;oldid=prev"/>
		<updated>2026-11-25T00:52:53Z</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            = Spark History Server&lt;br /&gt;
| also_known_as   = History server, port 18080&lt;br /&gt;
| field           = Monitoring and debugging&lt;br /&gt;
| key_parts       = Event log directory, FsHistoryProvider, local KV store, cleaner, REST API at /api/v1&lt;br /&gt;
| implementations = [[Apache Spark]]&lt;br /&gt;
| related         = [[Spark UI]], [[Spark event log]], [[Spark listener]]&lt;br /&gt;
}}&lt;br /&gt;
{{Verified|2026-11-23|the v4.3.0 tag of apache/spark (docs/monitoring.md, config/History.scala, config/package.scala, EventLoggingListener.scala, docs/core-migration-guide.md)}}&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;Spark History Server&amp;#039;&amp;#039;&amp;#039; is a long-running [[Apache Spark]] service that reads the [[Spark event log|event logs]] of applications and rebuilds their [[Spark UI]], so that jobs, stages, SQL queries and executors can be inspected after an application has finished. It is started with &amp;lt;code&amp;gt;./sbin/start-history-server.sh&amp;lt;/code&amp;gt; and serves a web interface at &amp;lt;code&amp;gt;http://&amp;amp;lt;server-url&amp;amp;gt;:18080&amp;lt;/code&amp;gt; by default, listing completed and incomplete applications.&amp;lt;ref name=&amp;quot;monitoring&amp;quot;&amp;gt;{{Cite web |url=https://spark.apache.org/docs/4.3.0/monitoring.html |title=Monitoring and Instrumentation (Spark 4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-23}}&amp;lt;/ref&amp;gt; The live Spark UI on port 4040 disappears when the driver exits; the History Server is how finished applications are debugged.&lt;br /&gt;
&lt;br /&gt;
== How does the Spark History Server work? ==&lt;br /&gt;
The History Server and the applications share a directory. Each application writes its event log there, and the server reads it:&amp;lt;ref name=&amp;quot;monitoring&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;properties&amp;quot;&amp;gt;&lt;br /&gt;
# On the applications&lt;br /&gt;
spark.eventLog.enabled   true&lt;br /&gt;
spark.eventLog.dir       hdfs://namenode/shared/spark-logs&lt;br /&gt;
&lt;br /&gt;
# On the History Server&lt;br /&gt;
spark.history.fs.logDirectory  hdfs://namenode/shared/spark-logs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Event logging is off by default (&amp;lt;code&amp;gt;spark.eventLog.enabled&amp;lt;/code&amp;gt;, default false), and both &amp;lt;code&amp;gt;spark.eventLog.dir&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;spark.history.fs.logDirectory&amp;lt;/code&amp;gt; default to &amp;lt;code&amp;gt;/tmp/spark-events&amp;lt;/code&amp;gt;.&amp;lt;ref name=&amp;quot;coreconf&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/spark/blob/v4.3.0/core/src/main/scala/org/apache/spark/internal/config/package.scala |title=config/package.scala (v4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;history&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/spark/blob/v4.3.0/core/src/main/scala/org/apache/spark/internal/config/History.scala |title=config/History.scala (v4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;ell&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/spark/blob/v4.3.0/core/src/main/scala/org/apache/spark/scheduler/EventLoggingListener.scala |title=EventLoggingListener.scala (v4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-23}}&amp;lt;/ref&amp;gt; &amp;lt;code&amp;gt;spark.history.fs.logDirectory&amp;lt;/code&amp;gt; accepts a comma-separated list of directories, so one server can watch several locations.&amp;lt;ref name=&amp;quot;history&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The default provider, &amp;lt;code&amp;gt;org.apache.spark.deploy.history.FsHistoryProvider&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;spark.history.provider&amp;lt;/code&amp;gt;), scans the directory every &amp;lt;code&amp;gt;spark.history.fs.update.interval&amp;lt;/code&amp;gt; (default 10s) for new or changed logs.&amp;lt;ref name=&amp;quot;history&amp;quot; /&amp;gt; When a user opens an application, the server replays its event log through the same status listeners that build the live UI, and caches the result. &amp;lt;code&amp;gt;spark.history.retainedApplications&amp;lt;/code&amp;gt; (default 50) sets how many applications&amp;#039; UI data stay in the cache; others are loaded from disk again when opened.&amp;lt;ref name=&amp;quot;history&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reading finished applications ==&lt;br /&gt;
The History Server shows the same tabs as the live [[Spark UI]]: Jobs, Stages, Storage, Environment, Executors and SQL. The same data is available from the REST API, at &amp;lt;code&amp;gt;http://&amp;amp;lt;server-url&amp;amp;gt;:18080/api/v1&amp;lt;/code&amp;gt;, which is useful for scripts that compare runs.&amp;lt;ref name=&amp;quot;monitoring&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Spark documentation lists several behaviours that surprise new users:&amp;lt;ref name=&amp;quot;monitoring&amp;quot; /&amp;gt;&lt;br /&gt;
* An application with several attempts shows its failed attempts, as well as the ongoing or final successful attempt.&lt;br /&gt;
* Incomplete (running) applications are refreshed only at each update interval. The documentation recommends viewing a running application in its own live UI.&lt;br /&gt;
* An application that exits without registering as complete, for example after a crash, stays listed as incomplete. Stopping the session explicitly (&amp;lt;code&amp;gt;spark.stop()&amp;lt;/code&amp;gt;) marks it complete.&lt;br /&gt;
&lt;br /&gt;
== Retention: how long are event logs kept? ==&lt;br /&gt;
The History Server does not delete event logs unless its cleaner is turned on. The cleaner settings at Spark 4.3.0 are:&amp;lt;ref name=&amp;quot;history&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;monitoring&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Setting !! Default !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spark.history.fs.cleaner.enabled&amp;lt;/code&amp;gt; || false || Turns on periodic deletion of event logs.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spark.history.fs.cleaner.interval&amp;lt;/code&amp;gt; || 1d || How often the cleaner runs.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spark.history.fs.cleaner.maxAge&amp;lt;/code&amp;gt; || 7d || Logs older than this are deleted.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spark.history.fs.cleaner.maxNum&amp;lt;/code&amp;gt; || Int.MaxValue || If there are more logs than this, the oldest completed attempts are deleted.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A log is deleted if either condition holds. When several log directories are configured, one cleaner cycle covers all of them.&amp;lt;ref name=&amp;quot;monitoring&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For long-running applications, the History Server can also compact rolled event logs. Setting &amp;lt;code&amp;gt;spark.history.fs.eventLog.rolling.maxFilesToRetain&amp;lt;/code&amp;gt; (default: all files kept) makes the server rewrite older rolled files into one compact file, dropping events for finished jobs, terminated executors and finished SQL executions. The documentation calls compaction lossy, notes that it may not run if little space would be saved, and asks users to use it with caution.&amp;lt;ref name=&amp;quot;monitoring&amp;quot; /&amp;gt; See [[Spark event log]] for rolling.&lt;br /&gt;
&lt;br /&gt;
== Running a History Server at scale ==&lt;br /&gt;
Replaying a large event log takes time and memory. Several settings help:&amp;lt;ref name=&amp;quot;history&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;monitoring&amp;quot; /&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;spark.history.store.path&amp;lt;/code&amp;gt; (no default) stores application data on local disk instead of in memory, and reuses it after a restart. &amp;lt;code&amp;gt;spark.history.store.maxDiskUsage&amp;lt;/code&amp;gt; (default 10g) caps that disk.&lt;br /&gt;
* &amp;lt;code&amp;gt;spark.history.store.hybridStore.enabled&amp;lt;/code&amp;gt; (default false, since 3.1.0) first parses logs into memory and then moves the result to disk, limited by &amp;lt;code&amp;gt;spark.history.store.hybridStore.maxMemoryUsage&amp;lt;/code&amp;gt; (default 2g).&lt;br /&gt;
* &amp;lt;code&amp;gt;spark.history.fs.numReplayThreads&amp;lt;/code&amp;gt; sets how many threads replay logs; its default is a quarter of the available cores.&lt;br /&gt;
* &amp;lt;code&amp;gt;SPARK_DAEMON_MEMORY&amp;lt;/code&amp;gt; sets the server&amp;#039;s memory (default 1g).&lt;br /&gt;
&lt;br /&gt;
Access control uses &amp;lt;code&amp;gt;spark.history.ui.acls.enable&amp;lt;/code&amp;gt; and the admin ACL settings, and Kerberos is supported with &amp;lt;code&amp;gt;spark.history.kerberos.enabled&amp;lt;/code&amp;gt;.&amp;lt;ref name=&amp;quot;history&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Spark UI]]&lt;br /&gt;
* [[Spark event log]]&lt;br /&gt;
* [[Spark listener]]&lt;br /&gt;
* [[Apache Spark]]&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>