Skip to content

Commit 0d13b2e

Browse files
andrewor14pdeyhim
authored andcommitted
[Fix apache#204] Eliminate delay between binding and log checking
**Bug**: In the existing history server, there is a `spark.history.updateInterval` seconds delay before application logs show up on the UI. **Cause**: This is because the following events happen in this order: (1) The background thread that checks for logs starts, but realizes the server has not yet bound and so waits for N seconds, (2) server binds, (3) N seconds later the background thread finds that the server has finally bound to a port, and so finally checks for application logs. **Fix**: This PR forces the log checking thread to start immediately after binding. It also documents two relevant environment variables that are currently missing. Author: Andrew Or <[email protected]> Closes apache#441 from andrewor14/history-server-fix and squashes the following commits: b2eb46e [Andrew Or] Document SPARK_PUBLIC_DNS and SPARK_HISTORY_OPTS for the history server e8d1fbc [Andrew Or] Eliminate delay between binding and checking for logs
1 parent d25fca8 commit 0d13b2e

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

core/src/main/scala/org/apache/spark/deploy/history/HistoryServer.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ class HistoryServer(
9898
def initialize() {
9999
attachPage(new HistoryPage(this))
100100
attachHandler(createStaticHandler(STATIC_RESOURCE_DIR, "/static"))
101+
}
102+
103+
/** Bind to the HTTP server behind this web interface. */
104+
override def bind() {
105+
super.bind()
101106
logCheckingThread.start()
102107
}
103108

docs/monitoring.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,33 @@ You can start a the history server by executing:
3939

4040
The base logging directory must be supplied, and should contain sub-directories that each
4141
represents an application's event logs. This creates a web interface at
42-
`http://<server-url>:18080` by default. The history server depends on the following variables:
42+
`http://<server-url>:18080` by default. The history server can be configured as follows:
4343

4444
<table class="table">
4545
<tr><th style="width:21%">Environment Variable</th><th>Meaning</th></tr>
4646
<tr>
4747
<td><code>SPARK_DAEMON_MEMORY</code></td>
48-
<td>Memory to allocate to the history server. (default: 512m).</td>
48+
<td>Memory to allocate to the history server (default: 512m).</td>
4949
</tr>
5050
<tr>
5151
<td><code>SPARK_DAEMON_JAVA_OPTS</code></td>
5252
<td>JVM options for the history server (default: none).</td>
5353
</tr>
54+
<tr>
55+
<td><code>SPARK_PUBLIC_DNS</code></td>
56+
<td>
57+
The public address for the history server. If this is not set, links to application history
58+
may use the internal address of the server, resulting in broken links (default: none).
59+
</td>
60+
</tr>
61+
<tr>
62+
<td><code>SPARK_HISTORY_OPTS</code></td>
63+
<td>
64+
<code>spark.history.*</code> configuration options for the history server (default: none).
65+
</td>
66+
</tr>
5467
</table>
5568

56-
Further, the history server can be configured as follows:
57-
5869
<table class="table">
5970
<tr><th>Property Name</th><th>Default</th><th>Meaning</th></tr>
6071
<tr>

0 commit comments

Comments
 (0)