Skip to content

Commit 1c53071

Browse files
committed
Address
1 parent 39ea357 commit 1c53071

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

core/src/main/scala/org/apache/spark/internal/config/Status.scala

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,9 @@ private[spark] object Status {
2929
.timeConf(TimeUnit.NANOSECONDS)
3030
.createWithDefaultString("100ms")
3131

32-
val LIVE_ENTITY_UPDATE_STALENESS_LIMIT = ConfigBuilder("spark.ui.liveUpdate.stalenessLimit")
33-
.internal()
34-
.doc(
35-
"""A time limit before we force to flush all live entities. When the last flush doesn't past
36-
|this limit, UI will not trigger a heavy flush to sync the states since it may slow down
37-
|Spark events processing significantly. Otherwise, UI will try to flush as soon as possible.
38-
""".stripMargin)
32+
val LIVE_ENTITY_UPDATE_MIN_FLUSH_PERIOD = ConfigBuilder("spark.ui.liveUpdate.minFlushPeriod")
33+
.doc("Minimum time elapsed before stale UI data is flushed. This avoids UI staleness when " +
34+
"incoming task events are not fired frequently.")
3935
.timeConf(TimeUnit.NANOSECONDS)
4036
.createWithDefaultString("1s")
4137

core/src/main/scala/org/apache/spark/status/AppStatusListener.scala

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,10 @@ private[spark] class AppStatusListener(
5959
private val liveUpdatePeriodNs = if (live) conf.get(LIVE_ENTITY_UPDATE_PERIOD) else -1L
6060

6161
/**
62-
* A time limit before we force to flush all live entities. When the last flush doesn't past
63-
* this limit, UI will not trigger a heavy flush to sync the states since it may slow down Spark
64-
* events processing significantly. Otherwise, UI will try to flush when receiving the next
65-
* executor heartbeat.
62+
* Minimum time elapsed before stale UI data is flushed. This avoids UI staleness when incoming
63+
* task events are not fired frequently.
6664
*/
67-
private val liveUpdateStalenessLimit = conf.get(LIVE_ENTITY_UPDATE_STALENESS_LIMIT)
65+
private val liveUpdateMinFlushPeriod = conf.get(LIVE_ENTITY_UPDATE_MIN_FLUSH_PERIOD)
6866

6967
private val maxTasksPerStage = conf.get(MAX_RETAINED_TASKS_PER_STAGE)
7068
private val maxGraphRootNodes = conf.get(MAX_RETAINED_ROOT_NODES)
@@ -845,8 +843,8 @@ private[spark] class AppStatusListener(
845843
}
846844
// Flush updates if necessary. Executor heartbeat is an event that happens periodically. Flush
847845
// here to ensure the staleness of Spark UI doesn't last more than
848-
// `max(heartbeat interval, liveUpdateStalenessLimit)`.
849-
if (now - lastFlushTimeNs > liveUpdateStalenessLimit) {
846+
// `max(heartbeat interval, liveUpdateMinFlushPeriod)`.
847+
if (now - lastFlushTimeNs > liveUpdateMinFlushPeriod) {
850848
flush(maybeUpdate(_, now))
851849
// Re-get the current system time because `flush` may be slow and `now` is stale.
852850
lastFlushTimeNs = System.nanoTime()

core/src/test/scala/org/apache/spark/ui/UISeleniumSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ class UISeleniumSuite extends SparkFunSuite with WebBrowser with Matchers with B
735735
// Set a small heart beat interval to make the test fast
736736
additionalConfs = Map(
737737
EXECUTOR_HEARTBEAT_INTERVAL.key -> "10ms",
738-
LIVE_ENTITY_UPDATE_STALENESS_LIMIT.key -> "10ms"))) { sc =>
738+
LIVE_ENTITY_UPDATE_MIN_FLUSH_PERIOD.key -> "10ms"))) { sc =>
739739
sc.setLocalProperty(SparkContext.SPARK_JOB_INTERRUPT_ON_CANCEL, "true")
740740
val f = sc.parallelize(1 to 1000, 1000).foreachAsync { _ =>
741741
// Make the task never finish so there won't be any task start/end events after the first 2

docs/configuration.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,14 @@ Apart from these, the following properties are also available, and may be useful
874874
operations that we can live without when rapidly processing incoming task events.
875875
</td>
876876
</tr>
877+
<tr>
878+
<td><code>spark.ui.liveUpdate.minFlushPeriod</code></td>
879+
<td>1s</td>
880+
<td>
881+
Minimum time elapsed before stale UI data is flushed. This avoids UI staleness when incoming
882+
task events are not fired frequently.
883+
</td>
884+
</tr>
877885
<tr>
878886
<td><code>spark.ui.port</code></td>
879887
<td>4040</td>

0 commit comments

Comments
 (0)