Skip to content

Conversation

@shahidki31
Copy link
Contributor

@shahidki31 shahidki31 commented Oct 5, 2018

What changes were proposed in this pull request?

Currently SQL tab in the WEBUI doesn't support pagination. Because of that following issues are happening.

  1. For large number of executions, SQL page is throwing OOM exception (around 40,000)
  2. For large number of executions, loading SQL page is taking time.
  3. Difficult to analyse the execution table for large number of execution.
    [Note: spark.sql.ui.retainedExecutions = 50000]

All the tabs, Jobs, Stages etc. supports pagination. So, to make it consistent with other tabs
SQL tab also should support pagination.

I have followed the similar flow of the pagination code in the Jobs and Stages page for SQL page.
Also, this patch doesn't make any behavior change for the SQL tab except the pagination support.

How was this patch tested?

bin/spark-shell --conf spark.sql.ui.retainedExecutions=50000
Run 50,000 sql queries.
Before this PR
screenshot from 2018-10-05 23-48-27

screenshot from 2018-10-05 22-58-11

After this PR

Loading of the page is faster, and OOM issue doesn't happen.
screenshot from 2018-10-05 23-50-32

[Spark Job History] SQL UI Page does not support Pagination
@shahidki31
Copy link
Contributor Author

cc @vanzin @srowen @cloud-fan @dongjoon-hyun . Kindly review the PR.

@shahidki31
Copy link
Contributor Author

Test step to reproduce OOM without the PR.

  1. bin/spark-shell --conf spark.sql.ui.retainedExecutions=50000
    for (i <- 0 until 50000) {
    val df = Seq(
    (1, 1),
    (2, 2)
    ).toDF()
    df.collect()

Without the PR:
screenshot from 2018-10-06 09-46-11

After fix:
screenshot from 2018-10-06 09-46-31

… with intercept with L1 regularization 1 min 10 sec
import org.apache.spark.JobExecutionStatus
import org.apache.spark.internal.Logging
import org.apache.spark.ui.{UIUtils, WebUIPage}
import org.apache.spark.ui._
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: can we avoid wildcard imports? we usually avoid them unless there are a very large number of classes to import

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. done. Thanks

val executionPrevPageSize = Option(parameterExecutionPrevPageSize).map(_.toInt).
getOrElse(executionPageSize)

val page: Int = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trivial nit: you don't need the type here or an extra block

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thanks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be private? and how about using interpolation for the whole thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thanks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and below, how about interpolation consistently?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thanks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be worth using case expressions to clarify what _3 and _1 are.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Done.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: pull this onto previous line? the indent is odd, at least

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thanks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this shouldn't be indented more

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I have used a different scalastyle and checkstyle xml in IJ it seems.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, here and around here do you really want to filter first instead of flatMap?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I have modified using filter

@shahidki31 shahidki31 force-pushed the SPARK-25566 branch 9 times, most recently from cf3a186 to 98e46ea Compare October 6, 2018 20:00
@shahidki31
Copy link
Contributor Author

Thank you @srowen for the review. I have addressed the comments.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a good place to wrap these to line up the elements in the Seq, one one each line (?) to make it easier to read its contents. They all seem to have an empty string as the second element? can it be removed or did I overlook something? Also you don't need the type here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I have modified based on your suggestions. Thanks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: pull this onto previous line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thanks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: space after if. Really, maybe just use require

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. used require. Thanks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.map { case (title, _, _) => title }?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Thanks.

@shahidki31 shahidki31 force-pushed the SPARK-25566 branch 3 times, most recently from d9df4ba to 2a3c534 Compare October 6, 2018 22:00
@shahidki31
Copy link
Contributor Author

Thank you @srowen , I have modified the code based on your suggestions.

@shahidki31
Copy link
Contributor Author

shahidki31 commented Oct 8, 2018

Hi @srowen , There is one behavior change this PR introduces, which is correct. Sorting Job Ids in the previous versions of spark was not proper. After the PR the sorting is proper.

Previous versions of spark:
screenshot from 2018-10-08 23-55-22

After the PR:
screenshot from 2018-10-08 23-54-00

I have updated the code accordingly.

@felixcheung
Copy link
Member

ok to test

@SparkQA
Copy link

SparkQA commented Oct 9, 2018

Test build #97144 has finished for PR 22645 at commit e6af675.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@felixcheung
Copy link
Member

@shahidki31 ^^

@shahidki31
Copy link
Contributor Author

Hi @felixcheung , I will update the code

@shahidki31
Copy link
Contributor Author

@felixcheung I build locally, Now scalastyle issue is not happening. kindly re-trigger the PR builder.

@SparkQA
Copy link

SparkQA commented Oct 9, 2018

Test build #97146 has finished for PR 22645 at commit 2b5a724.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@shahidki31
Copy link
Contributor Author

@felixcheung It is a random failure. Could you please re-trigger the test. Thanks
Please refer:
https://issues.apache.org/jira/browse/SPARK-23622

@SparkQA
Copy link

SparkQA commented Oct 9, 2018

Test build #4361 has finished for PR 22645 at commit 2b5a724.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@srowen
Copy link
Member

srowen commented Oct 12, 2018

Merged to master

@asfgit asfgit closed this in 3494b12 Oct 12, 2018
@shahidki31
Copy link
Contributor Author

Thanks a lot @srowen

@cloud-fan
Copy link
Contributor

I found the UI patches are very hard to review, because we embed HTML/Javascript in Scala code. Is there a plan to rewrite the Spark UI with some modern frontend frameworks?

@shahidki31
Copy link
Contributor Author

shahidki31 commented Oct 13, 2018

Hi @cloud-fan , Since other webui pages like jobs, stages, tasks etc. embed the javascript code in scala code, that is why I followed the same. It would be great if we rewrite the spark UI with some modern front end frameworks.

Also, after this PR, loading time of the SQL page improved significantly. earlier loading 55,000 queries sql page took ~4.34 mins from the history server, but after the PR took only ~4 sec.

jackylee-ch pushed a commit to jackylee-ch/spark that referenced this pull request Feb 18, 2019
… to avoid OOM

## What changes were proposed in this pull request?
Currently SQL tab in the WEBUI doesn't support pagination. Because of that following issues are happening.
1) For large number of executions, SQL page is throwing OOM exception (around 40,000)
2) For large number of executions, loading SQL page is taking time.
3) Difficult to analyse the execution table for large number of execution.
[Note: spark.sql.ui.retainedExecutions = 50000]

All the tabs, Jobs, Stages etc. supports pagination. So, to make it consistent with other tabs
SQL tab also should support pagination.

I have followed the similar flow of the pagination code in the Jobs and Stages page for SQL page.
Also, this patch doesn't make any behavior change for the SQL tab except the pagination support.

## How was this patch tested?
bin/spark-shell --conf spark.sql.ui.retainedExecutions=50000
Run 50,000 sql queries.
**Before this PR**
![screenshot from 2018-10-05 23-48-27](https://user-images.githubusercontent.com/23054875/46552750-4ed82480-c8f9-11e8-8b05-d60bedddd1b8.png)

![screenshot from 2018-10-05 22-58-11](https://user-images.githubusercontent.com/23054875/46550276-33b5e680-c8f2-11e8-9e32-9ae9c5b181e0.png)

**After this PR**

Loading of the page is faster, and OOM issue doesn't happen.
![screenshot from 2018-10-05 23-50-32](https://user-images.githubusercontent.com/23054875/46552814-8050f000-c8f9-11e8-96e9-42502d2cfaea.png)

Closes apache#22645 from shahidki31/SPARK-25566.

Authored-by: Shahid <[email protected]>
Signed-off-by: Sean Owen <[email protected]>
srowen pushed a commit that referenced this pull request Oct 24, 2019
### What changes were proposed in this pull request?
Supports pagination for SQL Statisitcs table in the JDBC/ODBC tab using existing Spark pagination framework.

### Why are the changes needed?
It will easier for user to analyse the table and it may fix the potential issues like oom while loading the page, that may occur similar to the SQL page (refer #22645)

### Does this PR introduce any user-facing change?
There will be no change in the `SQLStatistics` table in JDBC/ODBC server page execpt pagination support.

### How was this patch tested?
Manually verified.

Before PR:
![Screenshot 2019-10-22 at 11 37 29 PM](https://user-images.githubusercontent.com/23054875/67316080-73636680-f525-11e9-91bc-ff7e06e3736d.png)

After PR:

![Screenshot 2019-10-22 at 10 33 00 PM](https://user-images.githubusercontent.com/23054875/67316092-778f8400-f525-11e9-93f8-1e2815abd66f.png)

Closes #26215 from shahidki31/jdbcPagination.

Authored-by: shahid <[email protected]>
Signed-off-by: Sean Owen <[email protected]>
srowen pushed a commit that referenced this pull request Oct 26, 2019
… JDBC/ODBC Session page

### What changes were proposed in this pull request?
In the PR #26215, we supported pagination for sqlstats table in JDBC/ODBC server page. In this PR, we are extending the support of pagination to sqlstats session table by making use of existing pagination classes in #26215.

### Why are the changes needed?
Support pagination for sqlsessionstats table in JDBC/ODBC server page in the WEBUI. It will easier for user to analyse the table and it may fix the potential issues like oom while loading the page, that may occur similar to the SQL page (refer #22645)

### Does this PR introduce any user-facing change?
There will be no change in the sqlsessionstats table in JDBC/ODBC server page execpt pagination support.

### How was this patch tested?
Manually verified.

Before:

![Screenshot 2019-10-24 at 11 32 27 PM](https://user-images.githubusercontent.com/23054875/67512507-96715000-f6b6-11e9-9f1f-ab1877eb24e6.png)

After:

![Screenshot 2019-10-24 at 10 58 53 PM](https://user-images.githubusercontent.com/23054875/67512314-295dba80-f6b6-11e9-9e3e-dd50c6e62fe9.png)

Closes #26246 from shahidki31/SPARK_29589.

Authored-by: shahid <[email protected]>
Signed-off-by: Sean Owen <[email protected]>
dengziming pushed a commit to dengziming/spark that referenced this pull request Oct 28, 2019
… JDBC/ODBC Session page

In the PR apache#26215, we supported pagination for sqlstats table in JDBC/ODBC server page. In this PR, we are extending the support of pagination to sqlstats session table by making use of existing pagination classes in apache#26215.

Support pagination for sqlsessionstats table in JDBC/ODBC server page in the WEBUI. It will easier for user to analyse the table and it may fix the potential issues like oom while loading the page, that may occur similar to the SQL page (refer apache#22645)

There will be no change in the sqlsessionstats table in JDBC/ODBC server page execpt pagination support.

Manually verified.

Before:

![Screenshot 2019-10-24 at 11 32 27 PM](https://user-images.githubusercontent.com/23054875/67512507-96715000-f6b6-11e9-9f1f-ab1877eb24e6.png)

After:

![Screenshot 2019-10-24 at 10 58 53 PM](https://user-images.githubusercontent.com/23054875/67512314-295dba80-f6b6-11e9-9e3e-dd50c6e62fe9.png)

Closes apache#26246 from shahidki31/SPARK_29589.

Authored-by: shahid <[email protected]>
Signed-off-by: Sean Owen <[email protected]>
Signed-off-by: dengziming <[email protected]>
ulysses-you added a commit to apache/kyuubi that referenced this pull request Nov 23, 2021
…pache.spark.ui

<!--
Thanks for sending a pull request!

Here are some tips for you:
  1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/contributions.html
  2. If the PR is related to an issue in https://github.com/apache/incubator-kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
  3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
-->

### _Why are the changes needed?_
<!--
Please clarify why the changes are needed. For instance,
  1. If you add a feature, you can talk about the use case of it.
  2. If you fix a bug, you can clarify why it is a bug.
-->
In order to compaible with both Spark-2 and Spark-3, we should respect package `ui`, since apache/spark#22645, some class cope changed from package `ui` to `spark`.

### _How was this patch tested?_
Pass CI

Closes #1430 from ulysses-you/spark-2.4.

Closes #1429

8b40c60 [ulysses-you] nit
f875cda [ulysses-you] ui

Authored-by: ulysses-you <[email protected]>
Signed-off-by: ulysses-you <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants