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

YARN-10929. Refrain from creating new Configuration object in AbstractManagedParentQueue#initializeLeafQueueConfigs #3361

Closed
wants to merge 3 commits into from

Conversation

JackWangCS
Copy link
Contributor

Description of PR

Refrain from creating new Configuration object and remove the unneccessary configuration sorting in AbstractManagedParentQueue#initializeLeafQueueConfigs.

How was this patch tested?

This patch just refactor code and should be covered by exists test.

For code changes:

  • [Yes] Does the title or this PR starts with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')?
  • [No] Object storage: have the integration tests been executed and the endpoint declared according to the connector-specific documentation?
  • [No] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • [No] If applicable, have you updated the LICENSE, LICENSE-binary, NOTICE-binary files?

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 43s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
-1 ❌ test4tests 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
_ trunk Compile Tests _
+1 💚 mvninstall 31m 22s trunk passed
+1 💚 compile 1m 0s trunk passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04
+1 💚 compile 0m 53s trunk passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
+1 💚 checkstyle 0m 46s trunk passed
+1 💚 mvnsite 0m 58s trunk passed
+1 💚 javadoc 0m 44s trunk passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04
+1 💚 javadoc 0m 40s trunk passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
+1 💚 spotbugs 1m 58s trunk passed
+1 💚 shadedclient 15m 41s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 55s the patch passed
+1 💚 compile 0m 59s the patch passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04
+1 💚 javac 0m 59s the patch passed
+1 💚 compile 0m 48s the patch passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
+1 💚 javac 0m 48s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 36s hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager: The patch generated 0 new + 3 unchanged - 7 fixed = 3 total (was 10)
+1 💚 mvnsite 0m 52s the patch passed
+1 💚 javadoc 0m 40s the patch passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04
+1 💚 javadoc 0m 34s the patch passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
+1 💚 spotbugs 1m 55s the patch passed
+1 💚 shadedclient 15m 9s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 103m 34s hadoop-yarn-server-resourcemanager in the patch passed.
+1 💚 asflicense 0m 35s The patch does not generate ASF License warnings.
180m 46s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-3361/1/artifact/out/Dockerfile
GITHUB PR #3361
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell
uname Linux 642326d4020c 4.15.0-136-generic #140-Ubuntu SMP Thu Jan 28 05:20:47 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / fad6468
Default Java Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-3361/1/testReport/
Max. process+thread count 1003 (vs. ulimit of 5500)
modules C: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager U: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-3361/1/console
versions git=2.25.1 maven=3.6.3 spotbugs=4.2.2
Powered by Apache Yetus 0.14.0-SNAPSHOT https://yetus.apache.org

This message was automatically generated.

Copy link
Member

@brumi1024 brumi1024 left a comment

Choose a reason for hiding this comment

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

Thanks @JackWangCS for working on this! I had a few comments on the change.

Comment on lines 174 to 176
for (Map.Entry<String, String> confKeyValuePair :
csContext.getConfiguration().getPropsWithPrefix(prefix).entrySet()) {
configsWithPrefix.put(prefix + confKeyValuePair.getKey(), confKeyValuePair.getValue());
Copy link
Member

Choose a reason for hiding this comment

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

Instead of using the slower getPropsWithPrefix the optimised version could be used which was introduced in YARN-10838 and will be integrated in YARN-10872.


CapacitySchedulerConfiguration leafQueueConfigs = new
CapacitySchedulerConfiguration(new Configuration(false), false);
CapacitySchedulerConfiguration(csContext.getConf(), false);
Copy link
Member

Choose a reason for hiding this comment

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

This isn't entirely what we had in mind. Now every time a new dynamic queue is created every single property of capacity-scheduler.xml and yarn-site.xml is loaded into the newly created leafQueueConfigs, which could hinder the performance. The jira was more about getting rid of the config object duplication in the first place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @brumi1024 , thanks for your review. For my understanging, the AbstractManagedParentQueue#initializeLeafQueueConfigs is used to only initialize the leafQueueTemplate when the parent queue is initialized/re-initialized. And for each time, a newly created leafQueue should use this leafQueueTemplate to get its configuration via adding new configurations by replacing configurations with leaf-queue-template.
But now, in ManagedParentQueue#getLeafQueueConfigs, it creates a new configuration everytime. So we need to reuse getLeafQueueTemplate().getLeafQueueConfigs() directly instead of creating a new one. I mean we can change this to

public CapacitySchedulerConfiguration getLeafQueueConfigs(
      CapacitySchedulerConfiguration templateConfig, String leafQueueName) {
    CapacitySchedulerConfiguration leafQueueConfigTemplate = templateConfig;
    .....
  }

What do you think of?

Copy link
Member

Choose a reason for hiding this comment

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

Hi @JackWangCS,

Sorry I was not entirely clear. By now I mean the currently merged code creates a new Configuration object in ManagedParentQueue.getLeafQueueConfigs(CapacitySchedulerConfiguration templateConfig, String leafQueueName) (which is called every time an AutoCreatedLeafQueue is instantiated), but your patch solves that issue. However I'm thinking about a bigger change by completely removing the config object duplication (because it is error prone, see the bugfix YarnConfiguration.RESOURCE_TYPES property cloning) by doing something similar which the AQCv2 does (see the AutoCreatedQueueTemplate variable and its uses in ParentQueue and LeafQueue). This way the new template configs are added as if they would be normal user-defined configs, but it's better than creating a new half-filled config for every AutoCreatedLeafQueue or after your patch ManagedParent.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with @brumi1024 on this. We need to eliminate initializing an other configuration object, which is still happening in your current revision. My advise is to simply use csContext.getConfiguration to set the properties similar to AutoCreatedQueueTemplate class, as @brumi1024 suggested.

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 @9uapaw and @brumi1024. I made the initializeLeafQueueConfigs to use the csContext.getConfiguration directly. I will check the AQCv2 related code to see where we can reduce these configuration object duplication further.

Comment on lines 187 to 190
String resourceTypePrefix = YarnConfiguration.RESOURCE_TYPES + ".";
Map<String, String> rtConfigs = getCSConfigurationsWithPrefix(resourceTypePrefix);
for (Map.Entry<String, String> confKeyValuePair: rtConfigs.entrySet()) {
leafQueueConfigs.set(confKeyValuePair.getKey(), confKeyValuePair.getValue());
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is necessary anymore, if the whole config is duplicated. This is a property that comes from yarn-site.xml and it is necessary for the dynamic queues as well. If however the CapacitySchedulerConfiguration object is copied into the new one there is no need for copying these properties separately.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 42s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 1s codespell was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
-1 ❌ test4tests 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
_ trunk Compile Tests _
+1 💚 mvninstall 31m 40s trunk passed
+1 💚 compile 1m 1s trunk passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04
+1 💚 compile 0m 56s trunk passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
+1 💚 checkstyle 0m 48s trunk passed
+1 💚 mvnsite 1m 0s trunk passed
+1 💚 javadoc 0m 47s trunk passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04
+1 💚 javadoc 0m 44s trunk passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
+1 💚 spotbugs 1m 55s trunk passed
+1 💚 shadedclient 15m 14s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 52s the patch passed
+1 💚 compile 0m 53s the patch passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04
+1 💚 javac 0m 53s the patch passed
+1 💚 compile 0m 46s the patch passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
+1 💚 javac 0m 46s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
-0 ⚠️ checkstyle 0m 40s /results-checkstyle-hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-resourcemanager.txt hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager: The patch generated 2 new + 6 unchanged - 8 fixed = 8 total (was 14)
+1 💚 mvnsite 0m 50s the patch passed
+1 💚 javadoc 0m 38s the patch passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04
+1 💚 javadoc 0m 33s the patch passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
+1 💚 spotbugs 1m 51s the patch passed
+1 💚 shadedclient 14m 47s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 95m 46s hadoop-yarn-server-resourcemanager in the patch passed.
+1 💚 asflicense 0m 34s The patch does not generate ASF License warnings.
172m 32s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-3361/2/artifact/out/Dockerfile
GITHUB PR #3361
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell
uname Linux ac72f47cd0ec 4.15.0-136-generic #140-Ubuntu SMP Thu Jan 28 05:20:47 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / a7fd995
Default Java Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-3361/2/testReport/
Max. process+thread count 940 (vs. ulimit of 5500)
modules C: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager U: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-3361/2/console
versions git=2.25.1 maven=3.6.3 spotbugs=4.2.2
Powered by Apache Yetus 0.14.0-SNAPSHOT https://yetus.apache.org

This message was automatically generated.


CapacitySchedulerConfiguration leafQueueConfigs = new
CapacitySchedulerConfiguration(new Configuration(false), false);
CapacitySchedulerConfiguration(csContext.getConf(), false);
Copy link
Member

Choose a reason for hiding this comment

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

Hi @JackWangCS,

Sorry I was not entirely clear. By now I mean the currently merged code creates a new Configuration object in ManagedParentQueue.getLeafQueueConfigs(CapacitySchedulerConfiguration templateConfig, String leafQueueName) (which is called every time an AutoCreatedLeafQueue is instantiated), but your patch solves that issue. However I'm thinking about a bigger change by completely removing the config object duplication (because it is error prone, see the bugfix YarnConfiguration.RESOURCE_TYPES property cloning) by doing something similar which the AQCv2 does (see the AutoCreatedQueueTemplate variable and its uses in ParentQueue and LeafQueue). This way the new template configs are added as if they would be normal user-defined configs, but it's better than creating a new half-filled config for every AutoCreatedLeafQueue or after your patch ManagedParent.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 41s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 1s codespell was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
-1 ❌ test4tests 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
_ trunk Compile Tests _
+1 💚 mvninstall 31m 3s trunk passed
+1 💚 compile 1m 4s trunk passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04
+1 💚 compile 0m 56s trunk passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
+1 💚 checkstyle 0m 48s trunk passed
+1 💚 mvnsite 1m 0s trunk passed
+1 💚 javadoc 0m 47s trunk passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04
+1 💚 javadoc 0m 44s trunk passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
+1 💚 spotbugs 1m 50s trunk passed
+1 💚 shadedclient 15m 12s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 52s the patch passed
+1 💚 compile 0m 54s the patch passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04
+1 💚 javac 0m 54s the patch passed
+1 💚 compile 0m 47s the patch passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
+1 💚 javac 0m 47s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
-0 ⚠️ checkstyle 0m 38s /results-checkstyle-hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-resourcemanager.txt hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager: The patch generated 2 new + 6 unchanged - 8 fixed = 8 total (was 14)
+1 💚 mvnsite 0m 50s the patch passed
+1 💚 javadoc 0m 36s the patch passed with JDK Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04
+1 💚 javadoc 0m 34s the patch passed with JDK Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
+1 💚 spotbugs 1m 52s the patch passed
+1 💚 shadedclient 14m 48s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 97m 57s hadoop-yarn-server-resourcemanager in the patch passed.
+1 💚 asflicense 0m 34s The patch does not generate ASF License warnings.
174m 18s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-3361/3/artifact/out/Dockerfile
GITHUB PR #3361
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell
uname Linux 8c231c81d0bb 4.15.0-136-generic #140-Ubuntu SMP Thu Jan 28 05:20:47 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 6afab24
Default Java Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.11+9-Ubuntu-0ubuntu2.20.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_292-8u292-b10-0ubuntu1~20.04-b10
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-3361/3/testReport/
Max. process+thread count 945 (vs. ulimit of 5500)
modules C: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager U: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-3361/3/console
versions git=2.25.1 maven=3.6.3 spotbugs=4.2.2
Powered by Apache Yetus 0.14.0-SNAPSHOT https://yetus.apache.org

This message was automatically generated.

@szilard-nemeth szilard-nemeth self-assigned this Oct 23, 2021
@szilard-nemeth
Copy link
Contributor

Closing this PR in favor of #3744

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