Skip to content

TEZ-4580: Slow preemption of new containers when re-use is enabled - #374

Merged
abstractdog merged 5 commits into
apache:masterfrom
himanshu-mishra:master
Dec 23, 2024
Merged

TEZ-4580: Slow preemption of new containers when re-use is enabled#374
abstractdog merged 5 commits into
apache:masterfrom
himanshu-mishra:master

Conversation

@himanshu-mishra

Copy link
Copy Markdown
Contributor

When container reuse is enabled, preemption of lower priority containers that are not yet assigned to task, takes long time as they are released one at a time, and not the number of containers based when tez.am.preemption.percentage is high added in https://issues.apache.org/jira/browse/TEZ-1742.

Further investigation lead to following conclusion:

  1. Warn log / Assertion error thrown because in preemptIfNeeded(), when releasing new containers, the loop counter is being decremented with each releaseUnassignedContainers, leading to looping only half number of times. By using another counter, assertion passes because of condition method returns with check if (numPendingRequestsToService < 1) {.

  2. In releaseContainer(), the container is not getting removed from delayedContainers queue and only from heldContainers map, hence same container is being picked up for release in every iteration till next cycle of DelayedContainerManager finds out that the container is not in heldContainers and skips it with log Skipping delayed container as container is no longer running, containerId=...

This change adds a method in DelayedContainerManager to allow removal of delayed container and invokes it in releaseContainer method, which so far only removed it from heldContainers map.

@tez-yetus

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 9sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚@author0m 0sThe patch does not contain any @author tags.
+1 💚test4tests0m 0sThe patch appears to include 1 new or modified test files.
_ master Compile Tests _
+1 💚mvninstall15m 50smaster passed
+1 💚compile0m 26smaster passed with JDK Ubuntu-11.0.24+8-post-Ubuntu-1ubuntu322.04
+1 💚compile0m 22smaster passed with JDK Private Build-1.8.0_422-8u422-b05-1~22.04-b05
+1 💚checkstyle1m 21smaster passed
+1 💚javadoc0m 31smaster passed with JDK Ubuntu-11.0.24+8-post-Ubuntu-1ubuntu322.04
+1 💚javadoc0m 16smaster passed with JDK Private Build-1.8.0_422-8u422-b05-1~22.04-b05
+0 🆗spotbugs1m 20sUsed deprecated FindBugs config; considering switching to SpotBugs.
+1 💚findbugs1m 19smaster passed
_ Patch Compile Tests _
+1 💚mvninstall0m 15sthe patch passed
+1 💚compile0m 17sthe patch passed with JDK Ubuntu-11.0.24+8-post-Ubuntu-1ubuntu322.04
+1 💚javac0m 17sthe patch passed
+1 💚compile0m 14sthe patch passed with JDK Private Build-1.8.0_422-8u422-b05-1~22.04-b05
+1 💚javac0m 14sthe patch passed
-0 ⚠️checkstyle0m 13stez-dag: The patch generated 1 new + 146 unchanged - 0 fixed = 147 total (was 146)
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚javadoc0m 7sthe patch passed with JDK Ubuntu-11.0.24+8-post-Ubuntu-1ubuntu322.04
+1 💚javadoc0m 7sthe patch passed with JDK Private Build-1.8.0_422-8u422-b05-1~22.04-b05
+1 💚findbugs0m 46sthe patch passed
_ Other Tests _
+1 💚unit4m 25stez-dag in the patch passed.
+1 💚asflicense0m 15sThe patch does not generate ASF License warnings.
27m 34s
SubsystemReport/Notes
DockerClientAPI=1.47 ServerAPI=1.47 base: https://ci-hadoop.apache.org/job/tez-multibranch/job/PR-374/1/artifact/out/Dockerfile
GITHUB PR#374
JIRA IssueTEZ-4580
Optional Testsdupname asflicense javac javadoc unit spotbugs findbugs checkstyle compile
unameLinux 7ae9360fbab1 5.15.0-117-generic #127-Ubuntu SMP Fri Jul 5 20:13:28 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitypersonality/tez.sh
git revisionmaster / 607b2bc
Default JavaPrivate Build-1.8.0_422-8u422-b05-1~22.04-b05
Multi-JDK versions/usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.24+8-post-Ubuntu-1ubuntu322.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_422-8u422-b05-1~22.04-b05
checkstylehttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-374/1/artifact/out/diff-checkstyle-tez-dag.txt
Test Resultshttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-374/1/testReport/
Max. process+thread count201 (vs. ulimit of 5500)
modulesC: tez-dag U: tez-dag
Console outputhttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-374/1/console
versionsgit=2.34.1 maven=3.6.3 findbugs=3.0.1
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

if (delayedContainers.remove(container)) {
LOG.info("Removed {} from delayed containers", container.getContainer().getId());
} else {
LOG.warn("Unknown container {} sent for removal. Ignoring.", container.getContainer().getId());

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

A valid case here is when a new container is allocated - added to delayedContainers, it is polled (removed) from queue but if there is no pending task request releaseContainer() is invoked. Please suggest if the log level should be changed in info or for both the newly added logs should be at debug.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: I think we should change the log level to debug and print the only if LOG.isDebugEnabled() is true,

Similar to :
https://github.com/apache/tez/pull/374/files#diff-aaf0735de6615f8eeb8469ceadca2c3b0cdd578544a2564c37b299c55347188eR1548-R1550

Rest of the code LGTM .

@abstractdogabstractdogDec 21, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not sure about the log levels, let's keep the simple remove path on debug, as looks like the happy preemption path:

 LOG.debug("Removed {} from delayed containers", container.getContainer().getId());

isDebugEnabled is not necessary as long as we use the {} formatting (to prevent unnecessary string creation)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agreed.
Thank you @abstractdog for the review ! :)

prabhjyotsingh added a commit to acceldata-io/tez that referenced this pull request Nov 14, 2024
prabhjyotsingh added a commit to acceldata-io/tez that referenced this pull request Nov 20, 2024
prabhjyotsingh added a commit to acceldata-io/tez that referenced this pull request Nov 20, 2024
shubhluck pushed a commit to acceldata-io/tez that referenced this pull request Nov 21, 2024
@simhadri-g

simhadri-g commented Dec 10, 2024

Copy link
Copy Markdown
Member

@abstractdog can you please take a look when you are free. Thanks in advance! :)

}

void removeDelayedContainer(HeldContainer container) {
if (container != null) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this null check is not needed, as it's called from a block

 if (delayedContainer != null) {

@abstractdog

Copy link
Copy Markdown
Contributor

thanks @himanshu-mishra for taking care of this

according to the description of TEZ-1742:

Tez YARN Task Scheduler currently preempts 1 running task at a time when a higher priority task is waiting and there are no available resources. When a large number of higher priority tasks are pending then it can take a long time to preempt the required number of lower priority tasks.

after checking and trying out the unit test and the fix here, it seems like this patch what's exactly fixes the abovementioned problem

apart from the assertion error fix, the unit test indeed proves that releaseAssignedContainer is called as many times as needed according to the percentage config in a single round, so this looks good to me

only left a minor comment regarding a null check

@himanshu-mishra

Copy link
Copy Markdown
ContributorAuthor

Thanks @simhadri-g , @abstractdog for review. I have incorporated feedback as following:

  1. Keep only happy path log
  2. Remove null check
  3. Change log from info to debug

Also adding a note that as the the changes fixes slow preemption, it leads to performance gain mentioned in TEZ-1742 when container re-use is enabled, which is enabled by default in Tez.

@tez-yetus

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 9sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚@author0m 0sThe patch does not contain any @author tags.
+1 💚test4tests0m 0sThe patch appears to include 1 new or modified test files.
_ master Compile Tests _
+1 💚mvninstall5m 34smaster passed
+1 💚compile0m 22smaster passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu122.04
+1 💚compile0m 21smaster passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu222.04-ga
+1 💚checkstyle0m 53smaster passed
+1 💚javadoc0m 25smaster passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu122.04
+1 💚javadoc0m 12smaster passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu222.04-ga
+0 🆗spotbugs1m 13sUsed deprecated FindBugs config; considering switching to SpotBugs.
+1 💚findbugs1m 12smaster passed
_ Patch Compile Tests _
+1 💚mvninstall0m 14sthe patch passed
+1 💚compile0m 16sthe patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu122.04
+1 💚javac0m 16sthe patch passed
+1 💚compile0m 15sthe patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu222.04-ga
+1 💚javac0m 15sthe patch passed
-0 ⚠️checkstyle0m 10stez-dag: The patch generated 1 new + 146 unchanged - 0 fixed = 147 total (was 146)
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚javadoc0m 6sthe patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu122.04
+1 💚javadoc0m 6sthe patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu222.04-ga
+1 💚findbugs0m 41sthe patch passed
_ Other Tests _
+1 💚unit4m 14stez-dag in the patch passed.
+1 💚asflicense0m 14sThe patch does not generate ASF License warnings.
16m 3s
SubsystemReport/Notes
DockerClientAPI=1.47 ServerAPI=1.47 base: https://ci-hadoop.apache.org/job/tez-multibranch/job/PR-374/2/artifact/out/Dockerfile
GITHUB PR#374
JIRA IssueTEZ-4580
Optional Testsdupname asflicense javac javadoc unit spotbugs findbugs checkstyle compile
unameLinux dd3da0311850 5.15.0-124-generic #134-Ubuntu SMP Fri Sep 27 20:20:17 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitypersonality/tez.sh
git revisionmaster / 1084699
Default JavaPrivate Build-1.8.0_432-8u432-gaus1-0ubuntu222.04-ga
Multi-JDK versions/usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu122.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_432-8u432-gaus1-0ubuntu222.04-ga
checkstylehttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-374/2/artifact/out/diff-checkstyle-tez-dag.txt
Test Resultshttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-374/2/testReport/
Max. process+thread count227 (vs. ulimit of 5500)
modulesC: tez-dag U: tez-dag
Console outputhttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-374/2/console
versionsgit=2.34.1 maven=3.6.3 findbugs=3.0.1
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@tez-yetus

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 14sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚@author0m 0sThe patch does not contain any @author tags.
+1 💚test4tests0m 0sThe patch appears to include 1 new or modified test files.
_ master Compile Tests _
+1 💚mvninstall7m 29smaster passed
+1 💚compile0m 42smaster passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu122.04
+1 💚compile0m 40smaster passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu222.04-ga
+1 💚checkstyle0m 52smaster passed
+1 💚javadoc0m 29smaster passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu122.04
+1 💚javadoc0m 24smaster passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu222.04-ga
+0 🆗spotbugs1m 27sUsed deprecated FindBugs config; considering switching to SpotBugs.
+1 💚findbugs1m 25smaster passed
_ Patch Compile Tests _
+1 💚mvninstall0m 26sthe patch passed
+1 💚compile0m 28sthe patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu122.04
+1 💚javac0m 28sthe patch passed
+1 💚compile0m 25sthe patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu222.04-ga
+1 💚javac0m 25sthe patch passed
-0 ⚠️checkstyle0m 21stez-dag: The patch generated 1 new + 146 unchanged - 0 fixed = 147 total (was 146)
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚javadoc0m 9sthe patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu122.04
+1 💚javadoc0m 9sthe patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu222.04-ga
+1 💚findbugs1m 10sthe patch passed
_ Other Tests _
+1 💚unit5m 6stez-dag in the patch passed.
+1 💚asflicense0m 11sThe patch does not generate ASF License warnings.
21m 40s
SubsystemReport/Notes
DockerClientAPI=1.47 ServerAPI=1.47 base: https://ci-hadoop.apache.org/job/tez-multibranch/job/PR-374/3/artifact/out/Dockerfile
GITHUB PR#374
JIRA IssueTEZ-4580
Optional Testsdupname asflicense javac javadoc unit spotbugs findbugs checkstyle compile
unameLinux ea7ca84329e4 5.15.0-126-generic #136-Ubuntu SMP Wed Nov 6 10:38:22 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitypersonality/tez.sh
git revisionmaster / 1084699
Default JavaPrivate Build-1.8.0_432-8u432-gaus1-0ubuntu222.04-ga
Multi-JDK versions/usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu122.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_432-8u432-gaus1-0ubuntu222.04-ga
checkstylehttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-374/3/artifact/out/diff-checkstyle-tez-dag.txt
Test Resultshttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-374/3/testReport/
Max. process+thread count217 (vs. ulimit of 5500)
modulesC: tez-dag U: tez-dag
Console outputhttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-374/3/console
versionsgit=2.34.1 maven=3.6.3 findbugs=3.0.1
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@abstractdog

Copy link
Copy Markdown
Contributor

@himanshu-mishra : minor checkstyle left, can you please address:
./tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestTaskScheduler.java:1042: // We don't want containers to be assigned to a task by delayedContainerManager as it invokes another preemption flow: Line is longer than 120 characters (found 121). [LineLength]

@tez-yetus

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 9sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚@author0m 0sThe patch does not contain any @author tags.
+1 💚test4tests0m 0sThe patch appears to include 1 new or modified test files.
_ master Compile Tests _
+1 💚mvninstall6m 30smaster passed
+1 💚compile0m 25smaster passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu122.04
+1 💚compile0m 21smaster passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu222.04-ga
+1 💚checkstyle0m 33smaster passed
+1 💚javadoc0m 21smaster passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu122.04
+1 💚javadoc0m 16smaster passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu222.04-ga
+0 🆗spotbugs1m 1sUsed deprecated FindBugs config; considering switching to SpotBugs.
+1 💚findbugs0m 59smaster passed
_ Patch Compile Tests _
+1 💚mvninstall0m 19sthe patch passed
+1 💚compile0m 17sthe patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu122.04
+1 💚javac0m 17sthe patch passed
+1 💚compile0m 13sthe patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu222.04-ga
+1 💚javac0m 13sthe patch passed
+1 💚checkstyle0m 13sthe patch passed
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚javadoc0m 7sthe patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu122.04
+1 💚javadoc0m 8sthe patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu222.04-ga
+1 💚findbugs0m 47sthe patch passed
_ Other Tests _
+1 💚unit4m 15stez-dag in the patch passed.
+1 💚asflicense0m 14sThe patch does not generate ASF License warnings.
16m 50s
SubsystemReport/Notes
DockerClientAPI=1.47 ServerAPI=1.47 base: https://ci-hadoop.apache.org/job/tez-multibranch/job/PR-374/4/artifact/out/Dockerfile
GITHUB PR#374
JIRA IssueTEZ-4580
Optional Testsdupname asflicense javac javadoc unit spotbugs findbugs checkstyle compile
unameLinux 0ae4067883a1 5.15.0-124-generic #134-Ubuntu SMP Fri Sep 27 20:20:17 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitypersonality/tez.sh
git revisionmaster / b95defc
Default JavaPrivate Build-1.8.0_432-8u432-gaus1-0ubuntu222.04-ga
Multi-JDK versions/usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu122.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_432-8u432-gaus1-0ubuntu222.04-ga
Test Resultshttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-374/4/testReport/
Max. process+thread count202 (vs. ulimit of 5500)
modulesC: tez-dag U: tez-dag
Console outputhttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-374/4/console
versionsgit=2.34.1 maven=3.6.3 findbugs=3.0.1
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@abstractdog
abstractdog self-requested a review December 23, 2024 09:29

@abstractdogabstractdog left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM +1

@abstractdog
abstractdog merged commit 9efa6f1 into apache:masterDec 23, 2024
Sign up for freeto 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.

4 participants

@himanshu-mishra@tez-yetus@simhadri-g@abstractdog