-
Notifications
You must be signed in to change notification settings - Fork 13.8k
[FLINK-14747] Fix performance regression with latest changes to Mailbox #10177
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
Conversation
|
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community Automated ChecksLast check on commit 70195de (Wed Apr 15 11:37:09 UTC 2020) Warnings:
Mention the bot in a comment to re-run the automated checks. Review Progress
Please see the Pull Request Review Guide for a full explanation of the review process. DetailsThe Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commandsThe @flinkbot bot supports the following commands:
|
pnowojski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for quickly identifying the issue and fixing it. I've left couple of comments
...ing-java/src/main/java/org/apache/flink/streaming/runtime/tasks/mailbox/TaskMailboxImpl.java
Show resolved
Hide resolved
...ing-java/src/main/java/org/apache/flink/streaming/runtime/tasks/mailbox/TaskMailboxImpl.java
Show resolved
Hide resolved
...ing-java/src/main/java/org/apache/flink/streaming/runtime/tasks/mailbox/TaskMailboxImpl.java
Show resolved
Hide resolved
|
|
||
| @Nullable | ||
| private Mail takeOrNull(Deque<Mail> queue, int priority) { | ||
| checkTakeStateConditions(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this removed? Is it related to the performance fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bump?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's related to the correct behavior of take and tryTake. Internally, they know invoke that function takeOrNull twice, which would result in two state checks. By moving that to the callee, it's now a mini-tad faster ;).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I see now :)
...ing-java/src/main/java/org/apache/flink/streaming/runtime/tasks/mailbox/TaskMailboxImpl.java
Show resolved
Hide resolved
...ing-java/src/main/java/org/apache/flink/streaming/runtime/tasks/mailbox/TaskMailboxImpl.java
Outdated
Show resolved
Hide resolved
pnowojski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks almost good to me. I think one comment might have been not addressed.
|
|
||
| @Nullable | ||
| private Mail takeOrNull(Deque<Mail> queue, int priority) { | ||
| checkTakeStateConditions(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bump?
|
|
||
| @Nullable | ||
| private Mail takeOrNull(Deque<Mail> queue, int priority) { | ||
| checkTakeStateConditions(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I see now :)
pnowojski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AHeise there seems to be some test failures, including deadlocks.
avoid locks in case of empty mail queue.
MockStreamTask cannot call close on mailbox processor as we cannot assume that #cleanup is called from mailbox thread. Using a graceful termination allows the stream task and any using test harness to be closed from another thread for failure simulation.
operation may only occur through the mailbox thread, such that state checks do not any kind of synchronizations.
TaskMailboxImpl#tryTakeFromBatch.
requested priority if a batch is open.
pnowojski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing the tests! Merging.
What is the purpose of the change
Brief change log
Verifying this change
(Please pick either of the following options)
Does this pull request potentially affect one of the following parts:
@Public(Evolving): (no)Documentation