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-29043][Core] Improve the concurrent performance of History Server #25797

Closed
wants to merge 7 commits into from

Conversation

turboFei
Copy link
Member

@turboFei turboFei commented Sep 15, 2019

What changes were proposed in this pull request?

Even we set spark.history.fs.numReplayThreads to a large number, such as 30.
The history server still replays logs slowly.
We found that, if there is a straggler in a batch of replay tasks, all the other threads will wait for this
straggler.

In this PR, we create processing to save the logs which are being replayed.
So that the replay tasks can execute Asynchronously.

Why are the changes needed?

It can accelerate the speed to replay logs for history server.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

UT.

@turboFei turboFei changed the title [SPARK-29043] Improve the concurrent performance of History Server [WIP][SPARK-29043] Improve the concurrent performance of History Server Sep 15, 2019
@turboFei turboFei changed the title [WIP][SPARK-29043] Improve the concurrent performance of History Server [WIP][SPARK-29043][Core] Improve the concurrent performance of History Server Sep 15, 2019
@turboFei turboFei force-pushed the SPARK-29043 branch 3 times, most recently from ff7b9b9 to fa89be3 Compare September 15, 2019 15:58
@turboFei turboFei changed the title [WIP][SPARK-29043][Core] Improve the concurrent performance of History Server [SPARK-29043][Core] Improve the concurrent performance of History Server Sep 15, 2019
@dongjoon-hyun
Copy link
Member

ok to test

cc @wangyum

@turboFei
Copy link
Member Author

retest please

@HyukjinKwon
Copy link
Member

ok to test

@HyukjinKwon
Copy link
Member

cc @vanzin too

Copy link
Contributor

@HeartSaVioR HeartSaVioR left a comment

Choose a reason for hiding this comment

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

The code change looks OK, but I might be missing the effect where "listing" and "reloading applications" run concurrently. It would bring accessing some places via multi-threads which they weren't, so may need to check.

@wangyum
Copy link
Member

wangyum commented Sep 16, 2019

ok to test

@SparkQA
Copy link

SparkQA commented Sep 16, 2019

Test build #110636 has finished for PR 25797 at commit ec387f3.

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

@turboFei turboFei requested a review from kiszk September 17, 2019 03:05
@turboFei
Copy link
Member Author

gentle ping @dongjoon-hyun @HyukjinKwon

@kiszk
Copy link
Member

kiszk commented Sep 19, 2019

Looks good to me
Want to wait for comments from others cc @vanzin @wangyum

@turboFei
Copy link
Member Author

I just modify the a method from protected to private in new commit, it would not impact the test result.

@SparkQA
Copy link

SparkQA commented Sep 20, 2019

Test build #111038 has finished for PR 25797 at commit 1c36bfe.

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

Copy link
Member

@Ngone51 Ngone51 left a comment

Choose a reason for hiding this comment

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

Looks reasonable.

@turboFei
Copy link
Member Author

I just add some comment and rename a method, which would not impact the test result.

@SparkQA
Copy link

SparkQA commented Sep 20, 2019

Test build #111074 has finished for PR 25797 at commit 12f6300.

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

@turboFei
Copy link
Member Author

@cloud-fan Could you help take a look?

@kiszk
Copy link
Member

kiszk commented Sep 26, 2019

ping @vanzin @wangyum

@gengliangwang
Copy link
Member

Seems good to me.
@turboFei Have you tested the changes manually?

@turboFei
Copy link
Member Author

Seems good to me.
@turboFei Have you tested the changes manually?

I have tested it for a week, it works well.

@SparkQA
Copy link

SparkQA commented Nov 6, 2019

Test build #113321 has finished for PR 25797 at commit 611ea30.

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

@SparkQA
Copy link

SparkQA commented Nov 6, 2019

Test build #113328 has finished for PR 25797 at commit 832dd7a.

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

@SparkQA
Copy link

SparkQA commented Nov 6, 2019

Test build #113330 has finished for PR 25797 at commit 8c0b532.

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

@SparkQA
Copy link

SparkQA commented Nov 6, 2019

Test build #113332 has finished for PR 25797 at commit 66e9dd1.

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

endProcessing(reader.rootPath)
pendingReplayTasksCount.decrementAndGet()

val isExpired = scanTime + conf.get(MAX_LOG_AGE_S) * 1000 < clock.getTimeMillis()
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not right. Expiration is based on the time the log was last updated, not the time it was last scanned.


val isExpired = scanTime + conf.get(MAX_LOG_AGE_S) * 1000 < clock.getTimeMillis()
if (isExpired) {
listing.delete(classOf[LogInfo], reader.rootPath.toString)
Copy link
Contributor

Choose a reason for hiding this comment

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

You may also need to remove the application attempt that refers to the log from the listing database.

Basically you have to do what cleanLogs does, both to define whether the log is expired, and what needs to be deleted.

Copy link
Member Author

Choose a reason for hiding this comment

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

done.

@SparkQA
Copy link

SparkQA commented Nov 7, 2019

Test build #113379 has finished for PR 25797 at commit d5ff72c.

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

@turboFei
Copy link
Member Author

turboFei commented Nov 7, 2019

retest this please.

@turboFei
Copy link
Member Author

rebased.

@SparkQA
Copy link

SparkQA commented Nov 12, 2019

Test build #113625 has finished for PR 25797 at commit 579c1ad.

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

@SparkQA
Copy link

SparkQA commented Nov 12, 2019

Test build #113626 has finished for PR 25797 at commit 7d1301c.

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

@HeartSaVioR
Copy link
Contributor

@turboFei Hi, could you address the review comments? This is good to have and seems close to be merged (according to #26416 (review) ).

@turboFei
Copy link
Member Author

@turboFei Hi, could you address the review comments? This is good to have and seems close to be merged (according to #26416 (review) ).

Thanks, I will address it as soon as possible.
Thanks for your reminder. @HeartSaVioR


log.appId.foreach { appId =>
val app = listing.read(classOf[ApplicationInfoWrapper], appId)
if (app.oldestAttempt() <= maxTime) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Here the logic is consistent with cleanLogs().
But, I think there is an overlap between app.oldestAttempt() <= maxTime and attempt.info.lastUpdated.getTime() >= maxTime, even it does not matter.

@SparkQA
Copy link

SparkQA commented Dec 13, 2019

Test build #115300 has finished for PR 25797 at commit c6ac35e.

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

@SparkQA
Copy link

SparkQA commented Dec 14, 2019

Test build #115334 has finished for PR 25797 at commit e9ebb6f.

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

Copy link
Contributor

@vanzin vanzin left a comment

Choose a reason for hiding this comment

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

Looks ok now. Merging to master.

@@ -1321,6 +1321,35 @@ class FsHistoryProviderSuite extends SparkFunSuite with Matchers with Logging {
assertSerDe(serializer, attemptInfoWithIndex)
}

test("SPARK-29043: clean up specified event log") {
val clock = new ManualClock()
val conf = createTestConf().set(MAX_LOG_AGE_S.key, "0").set(CLEANER_ENABLED.key, "true")
Copy link
Contributor

@vanzin vanzin Dec 16, 2019

Choose a reason for hiding this comment

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

No need to use .key here.

(I'll fix this during merge.)

@vanzin vanzin closed this in 5954311 Dec 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet