Skip to content

Commit 582ed8a

Browse files
Davies Liudavies
authored andcommitted
[SPARK-14544] [SQL] improve performance of SQL UI tab
## What changes were proposed in this pull request? This PR improve the performance of SQL UI by: 1) remove the details column in all executions page (the first page in SQL tab). We can check the details by enter the execution page. 2) break-all is super slow in Chrome recently, so switch to break-word. 3) Using "display: none" to hide a block. 4) using one js closure for for all the executions, not one for each. 5) remove the height limitation of details, don't need to scroll it in the tiny window. ## How was this patch tested? Exists tests. ![ui](https://cloud.githubusercontent.com/assets/40902/14445712/68d7b258-0004-11e6-9b48-5d329b05d165.png) Author: Davies Liu <davies@databricks.com> Closes apache#12311 from davies/ui_perf.
1 parent 2554c35 commit 582ed8a

3 files changed

Lines changed: 17 additions & 35 deletions

File tree

core/src/main/resources/org/apache/spark/ui/static/webui.css

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,22 @@ pre {
106106
line-height: 18px;
107107
padding: 6px;
108108
margin: 0;
109+
word-break: break-word;
109110
border-radius: 3px;
110111
}
111112

112113
.stage-details {
113-
max-height: 100px;
114114
overflow-y: auto;
115115
margin: 0;
116+
display: block;
116117
transition: max-height 0.25s ease-out, padding 0.25s ease-out;
117118
}
118119

119120
.stage-details.collapsed {
120-
max-height: 0;
121121
padding-top: 0;
122122
padding-bottom: 0;
123123
border: none;
124+
display: none;
124125
}
125126

126127
.description-input {
@@ -143,14 +144,15 @@ pre {
143144
max-height: 300px;
144145
overflow-y: auto;
145146
margin: 0;
147+
display: block;
146148
transition: max-height 0.25s ease-out, padding 0.25s ease-out;
147149
}
148150

149151
.stacktrace-details.collapsed {
150-
max-height: 0;
151152
padding-top: 0;
152153
padding-bottom: 0;
153154
border: none;
155+
display: none;
154156
}
155157

156158
span.expand-additional-metrics, span.expand-dag-viz {

sql/core/src/main/scala/org/apache/spark/sql/execution/ui/AllExecutionsPage.scala

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ private[ui] class AllExecutionsPage(parent: SQLTab) extends WebUIPage("") with L
5555
}
5656
_content
5757
}
58+
content ++=
59+
<script>
60+
function clickDetail(details) {{
61+
details.parentNode.querySelector('.stage-details').classList.toggle('collapsed')
62+
}}
63+
</script>
5864
UIUtils.headerSparkPage("SQL", content, parent, Some(5000))
5965
}
6066
}
@@ -118,14 +124,12 @@ private[ui] abstract class ExecutionTable(
118124
{failedJobs}
119125
</td>
120126
}}
121-
{detailCell(executionUIData.physicalPlanDescription)}
122127
</tr>
123128
}
124129

125130
private def descriptionCell(execution: SQLExecutionUIData): Seq[Node] = {
126131
val details = if (execution.details.nonEmpty) {
127-
<span onclick="this.parentNode.querySelector('.stage-details').classList.toggle('collapsed')"
128-
class="expand-details">
132+
<span onclick="clickDetail(this)" class="expand-details">
129133
+details
130134
</span> ++
131135
<div class="stage-details collapsed">
@@ -142,30 +146,6 @@ private[ui] abstract class ExecutionTable(
142146
<div>{desc} {details}</div>
143147
}
144148

145-
private def detailCell(physicalPlan: String): Seq[Node] = {
146-
val isMultiline = physicalPlan.indexOf('\n') >= 0
147-
val summary = StringEscapeUtils.escapeHtml4(
148-
if (isMultiline) {
149-
physicalPlan.substring(0, physicalPlan.indexOf('\n'))
150-
} else {
151-
physicalPlan
152-
})
153-
val details = if (isMultiline) {
154-
// scalastyle:off
155-
<span onclick="this.parentNode.querySelector('.stacktrace-details').classList.toggle('collapsed')"
156-
class="expand-details">
157-
+details
158-
</span> ++
159-
<div class="stacktrace-details collapsed">
160-
<pre>{physicalPlan}</pre>
161-
</div>
162-
// scalastyle:on
163-
} else {
164-
""
165-
}
166-
<td>{summary}{details}</td>
167-
}
168-
169149
def toNodeSeq: Seq[Node] = {
170150
<div>
171151
<h4>{tableName}</h4>
@@ -197,7 +177,7 @@ private[ui] class RunningExecutionTable(
197177
showFailedJobs = true) {
198178

199179
override protected def header: Seq[String] =
200-
baseHeader ++ Seq("Running Jobs", "Succeeded Jobs", "Failed Jobs", "Detail")
180+
baseHeader ++ Seq("Running Jobs", "Succeeded Jobs", "Failed Jobs")
201181
}
202182

203183
private[ui] class CompletedExecutionTable(
@@ -215,7 +195,7 @@ private[ui] class CompletedExecutionTable(
215195
showSucceededJobs = true,
216196
showFailedJobs = false) {
217197

218-
override protected def header: Seq[String] = baseHeader ++ Seq("Jobs", "Detail")
198+
override protected def header: Seq[String] = baseHeader ++ Seq("Jobs")
219199
}
220200

221201
private[ui] class FailedExecutionTable(
@@ -234,5 +214,5 @@ private[ui] class FailedExecutionTable(
234214
showFailedJobs = true) {
235215

236216
override protected def header: Seq[String] =
237-
baseHeader ++ Seq("Succeeded Jobs", "Failed Jobs", "Detail")
217+
baseHeader ++ Seq("Succeeded Jobs", "Failed Jobs")
238218
}

streaming/src/test/scala/org/apache/spark/streaming/UISeleniumSuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ class UISeleniumSuite
164164
(List("1/1", "1/1", "1/1", "0/1 (1 failed)"))
165165

166166
// Check stacktrace
167-
val errorCells = findAll(cssSelector(""".stacktrace-details""")).map(_.text).toSeq
167+
val errorCells = findAll(cssSelector(""".stacktrace-details""")).map(_.underlying).toSeq
168168
errorCells should have size 1
169-
errorCells(0) should include("java.lang.RuntimeException: Oops")
169+
// Can't get the inner (invisible) text without running JS
170170

171171
// Check the job link in the batch page is right
172172
go to (jobLinks(0))

0 commit comments

Comments
 (0)