Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-14269][SCHEDULER] Eliminate unnecessary submitStage() call. #12060

Closed
wants to merge 19 commits into from

Conversation

ueshin
Copy link
Member

@ueshin ueshin commented Mar 30, 2016

What changes were proposed in this pull request?

Currently a method submitStage() for waiting stages is called on every iteration of the event loop in DAGScheduler to submit all waiting stages, but most of them are not necessary because they are not related to Stage status.
The case we should try to submit waiting stages is only when their parent stages are successfully completed.

This elimination can improve DAGScheduler performance.

How was this patch tested?

Added some checks and other existing tests, and our projects.

We have a project bottle-necked by DAGScheduler, having about 2000 stages.

Before this patch the almost all execution time in Driver process was spent to process submitStage() of dag-scheduler-event-loop thread but after this patch the performance was improved as follows:

total execution time dag-scheduler-event-loop thread time submitStage()
Before 760 sec 710 sec 667 sec
After 440 sec 14 sec 10 sec

@ueshin
Copy link
Member Author

ueshin commented Mar 30, 2016

This PR is based on #11720, so please check it first.

@SparkQA
Copy link

SparkQA commented Mar 30, 2016

Test build #54509 has finished for PR 12060 at commit a304235.

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

@maropu
Copy link
Member

maropu commented Mar 30, 2016

Seems that this optimization must need correct stage graphs fixed in #11720, is this correct?

@ueshin
Copy link
Member Author

ueshin commented Mar 30, 2016

Yes, that's right.
#11720 is needed to find child stages correctly.

@maropu
Copy link
Member

maropu commented Mar 30, 2016

If so, it'd be better to close #11720; the benefit of correct stage graphs fixed in #11720 seems to be clear in this pr.

@@ -1247,7 +1252,7 @@ class DAGScheduler(
}
}

// Note: newly runnable stages will be submitted below when we submit waiting stages
submitWaitingChildStages(shuffleStage)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be done when !shuffleStage.isAvailable and we have resubmitted the shuffleStage, or only within the else branch?

Copy link
Member Author

Choose a reason for hiding this comment

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

@markhamstra Thank you for your review.
Definitely we can move this into else branch.
I'll modify it.

@ueshin
Copy link
Member Author

ueshin commented Mar 31, 2016

@maropu I see. I'll close #11720.

@ueshin ueshin changed the title [SPARK-14269][SCHEDULER] Eliminate unnecessary submitStage() call. [SPARK-13902][SPARK-14269][SCHEDULER] Eliminate unnecessary submitStage() call. Mar 31, 2016
@SparkQA
Copy link

SparkQA commented Mar 31, 2016

Test build #54582 has finished for PR 12060 at commit f1407c0.

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

@ueshin
Copy link
Member Author

ueshin commented Mar 31, 2016

Jenkins, retest this please.

@SparkQA
Copy link

SparkQA commented Mar 31, 2016

Test build #54595 has finished for PR 12060 at commit f1407c0.

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

for (stage <- waitingStagesCopy.sortBy(_.firstJobId)) {
val childStages = waitingStages.filter(_.parents.contains(parent)).toArray
waitingStages --= childStages
for (stage <- childStages.sortBy(_.firstJobId)) {
submitStage(stage)
Copy link
Member

Choose a reason for hiding this comment

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

Seems submitWaitingChildStages is called to submit child stages when the given parent stage is available. From this observation, do we have to re-check missing parents inside submitStage?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, and the re-check is done in the submitStage().
If there are some missing parent stages, the child will go to waitingStages again.

Copy link
Member

Choose a reason for hiding this comment

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

Ahah, I see.

@maropu
Copy link
Member

maropu commented Apr 1, 2016

This pr seems great in terms of spark-core performance, so could you assign qualified guys to review this? cc: @rxin

@ueshin ueshin changed the title [SPARK-13902][SPARK-14269][SCHEDULER] Eliminate unnecessary submitStage() call. [SPARK-14269][SCHEDULER] Eliminate unnecessary submitStage() call. May 13, 2016
@SparkQA
Copy link

SparkQA commented May 13, 2016

Test build #58529 has finished for PR 12060 at commit 0c0d9ed.

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

@zzcclp
Copy link
Contributor

zzcclp commented May 13, 2016

Good PR, will it plan to be merged into branch-1.6?

@markhamstra
Copy link
Contributor

@zzcclp Not likely. This PR shouldn't produce any different results, but rather produces the same results faster. We're typically very conservative with patch-level releases, so the optimization work for this PR will almost certainly only appear in the Spark 2.x series. That's not too far off.

@zzcclp
Copy link
Contributor

zzcclp commented May 13, 2016

@markhamstra , thanks for your explaintion.

@@ -1357,7 +1345,6 @@ class DAGScheduler(
logDebug("Additional executor lost message for " + execId +
"(epoch " + currentEpoch + ")")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary to submit some newly-waiting stages here (e.g., if shuffle output was lost for a map stage, so now that map stage needs to be re-run)?

Copy link
Contributor

Choose a reason for hiding this comment

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

This appears to be a non-issue, because we handle lost shuffle output separately, when we get a FetchFailure from a task that tries to fetch the output.

@kayousterhout
Copy link
Contributor

This LGTM with the small comment changes I suggested. @markhamstra any objections to this? Mark / @rxin thoughts on merging it into the 2.0 branch?

@ueshin
Copy link
Member Author

ueshin commented May 17, 2016

@kayousterhout Thank you for your review.
I updated the comments and pushed.

@SparkQA
Copy link

SparkQA commented May 17, 2016

Test build #58659 has finished for PR 12060 at commit 4eb8c05.

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

@SparkQA
Copy link

SparkQA commented May 23, 2016

Test build #59133 has finished for PR 12060 at commit 4eb8c05.

  • This patch fails from timeout after a configured wait of 250m.
  • This patch merges cleanly.
  • This patch adds no public classes.

@ueshin
Copy link
Member Author

ueshin commented May 23, 2016

Jenkins, retest this please.

@SparkQA
Copy link

SparkQA commented May 23, 2016

Test build #59153 has finished for PR 12060 at commit 4eb8c05.

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

@kayousterhout
Copy link
Contributor

I merged this into master (not 2.0, since it's a performance problem rather than a correctness problem, and this isn't a regression). Thanks @ueshin!

@asfgit asfgit closed this in 698ef76 May 25, 2016
@ueshin
Copy link
Member Author

ueshin commented May 25, 2016

Thanks a lot for merging this!

ueshin added a commit to ueshin/apache-spark that referenced this pull request May 27, 2016
Currently a method `submitStage()` for waiting stages is called on every iteration of the event loop in `DAGScheduler` to submit all waiting stages, but most of them are not necessary because they are not related to Stage status.
The case we should try to submit waiting stages is only when their parent stages are successfully completed.

This elimination can improve `DAGScheduler` performance.

Added some checks and other existing tests, and our projects.

We have a project bottle-necked by `DAGScheduler`, having about 2000 stages.

Before this patch the almost all execution time in `Driver` process was spent to process `submitStage()` of `dag-scheduler-event-loop` thread but after this patch the performance was improved as follows:

|        | total execution time | `dag-scheduler-event-loop` thread time | `submitStage()` |
|--------|---------------------:|---------------------------------------:|----------------:|
| Before |              760 sec |                                710 sec |         667 sec |
| After  |              440 sec |                                 14 sec |          10 sec |

Author: Takuya UESHIN <ueshin@happy-camper.st>

Closes apache#12060 from ueshin/issues/SPARK-14269.
ueshin added a commit to ueshin/apache-spark that referenced this pull request Jun 28, 2016
Currently a method `submitStage()` for waiting stages is called on every iteration of the event loop in `DAGScheduler` to submit all waiting stages, but most of them are not necessary because they are not related to Stage status.
The case we should try to submit waiting stages is only when their parent stages are successfully completed.

This elimination can improve `DAGScheduler` performance.

Added some checks and other existing tests, and our projects.

We have a project bottle-necked by `DAGScheduler`, having about 2000 stages.

Before this patch the almost all execution time in `Driver` process was spent to process `submitStage()` of `dag-scheduler-event-loop` thread but after this patch the performance was improved as follows:

|        | total execution time | `dag-scheduler-event-loop` thread time | `submitStage()` |
|--------|---------------------:|---------------------------------------:|----------------:|
| Before |              760 sec |                                710 sec |         667 sec |
| After  |              440 sec |                                 14 sec |          10 sec |

Author: Takuya UESHIN <ueshin@happy-camper.st>

Closes apache#12060 from ueshin/issues/SPARK-14269.
ueshin added a commit to ueshin/apache-spark that referenced this pull request Jul 27, 2016
## What changes were proposed in this pull request?

Currently a method `submitStage()` for waiting stages is called on every iteration of the event loop in `DAGScheduler` to submit all waiting stages, but most of them are not necessary because they are not related to Stage status.
The case we should try to submit waiting stages is only when their parent stages are successfully completed.

This elimination can improve `DAGScheduler` performance.

## How was this patch tested?

Added some checks and other existing tests, and our projects.

We have a project bottle-necked by `DAGScheduler`, having about 2000 stages.

Before this patch the almost all execution time in `Driver` process was spent to process `submitStage()` of `dag-scheduler-event-loop` thread but after this patch the performance was improved as follows:

|        | total execution time | `dag-scheduler-event-loop` thread time | `submitStage()` |
|--------|---------------------:|---------------------------------------:|----------------:|
| Before |              760 sec |                                710 sec |         667 sec |
| After  |              440 sec |                                 14 sec |          10 sec |

Author: Takuya UESHIN <ueshin@happy-camper.st>

Closes apache#12060 from ueshin/issues/SPARK-14269.
ueshin added a commit to ueshin/apache-spark that referenced this pull request Oct 5, 2016
## What changes were proposed in this pull request?

Currently a method `submitStage()` for waiting stages is called on every iteration of the event loop in `DAGScheduler` to submit all waiting stages, but most of them are not necessary because they are not related to Stage status.
The case we should try to submit waiting stages is only when their parent stages are successfully completed.

This elimination can improve `DAGScheduler` performance.

## How was this patch tested?

Added some checks and other existing tests, and our projects.

We have a project bottle-necked by `DAGScheduler`, having about 2000 stages.

Before this patch the almost all execution time in `Driver` process was spent to process `submitStage()` of `dag-scheduler-event-loop` thread but after this patch the performance was improved as follows:

|        | total execution time | `dag-scheduler-event-loop` thread time | `submitStage()` |
|--------|---------------------:|---------------------------------------:|----------------:|
| Before |              760 sec |                                710 sec |         667 sec |
| After  |              440 sec |                                 14 sec |          10 sec |

Author: Takuya UESHIN <ueshin@happy-camper.st>

Closes apache#12060 from ueshin/issues/SPARK-14269.
ueshin added a commit to ueshin/apache-spark that referenced this pull request Nov 15, 2016
## What changes were proposed in this pull request?

Currently a method `submitStage()` for waiting stages is called on every iteration of the event loop in `DAGScheduler` to submit all waiting stages, but most of them are not necessary because they are not related to Stage status.
The case we should try to submit waiting stages is only when their parent stages are successfully completed.

This elimination can improve `DAGScheduler` performance.

## How was this patch tested?

Added some checks and other existing tests, and our projects.

We have a project bottle-necked by `DAGScheduler`, having about 2000 stages.

Before this patch the almost all execution time in `Driver` process was spent to process `submitStage()` of `dag-scheduler-event-loop` thread but after this patch the performance was improved as follows:

|        | total execution time | `dag-scheduler-event-loop` thread time | `submitStage()` |
|--------|---------------------:|---------------------------------------:|----------------:|
| Before |              760 sec |                                710 sec |         667 sec |
| After  |              440 sec |                                 14 sec |          10 sec |

Author: Takuya UESHIN <ueshin@happy-camper.st>

Closes apache#12060 from ueshin/issues/SPARK-14269.
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.

7 participants