Skip to content

HADOOP-17295 Move dedicated pre-logging statements into existing logg… #2358

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

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

coder-chenzhi
Copy link

@coder-chenzhi coder-chenzhi commented Oct 3, 2020

I find some cases where some pre-processing statements dedicated to logging calls are not guarded by existing logging guards. Most of them are easy to fix. And the performance and maintainability of these logging calls can be improved to some extend. So I create this PR to fix them. I guess there is no need to add new test cases.

These issues are detected by a static analysis tool wrote by myself. This tool can extract all the dedicated statements for each debug-logging calls (i.e., the results of these statements are only used by debug-logging calls). Because I realize that debug logs will incur overhead in production, such as string concatenation and method calls in the parameters of logging calls. And I want to perform a systematic evaluation for the overhead of debugging logging calls in production.

Copy link
Contributor

@steveloughran steveloughran left a comment

Choose a reason for hiding this comment

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

This is potentially useful, though you should know we are scared of giant patches which span everything -they make backporting really hard. package-by-package would be better.

  1. a lot of the old logging was based on commons-logging APIs, there's a lot of concatenation there.
  2. toString() calls in logging is also needless and expensive, e.g LOG.debug("status ={}", status.toString())
  3. needless operations before logging matter most for debug logging, as it is usually off by default. info/warn/error we don't need to guard
  4. At the same time, what matters there, especially for info, is probably the cost of the evaluation: its the cost of the toString and other calls which would be most beneficial

@coder-chenzhi
Copy link
Author

@steveloughran Appreciate your review. Your comment on the logging overhead is valuable for me.

I have another question that I would like to hear your thoughts. Do you prefer to reduce accumulated overhead or average overhead? The point is that some simple logging calls are on the hot path and frequently executed. The accumulated overhead for these simple logging calls is larger than other complex logging calls rarely executed.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 1m 6s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+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 _
+0 🆗 mvndep 6m 3s Maven dependency ordering for branch
+1 💚 mvninstall 26m 19s trunk passed
+1 💚 compile 24m 24s trunk passed with JDK Ubuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1
+1 💚 compile 18m 0s trunk passed with JDK Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
+1 💚 checkstyle 2m 56s trunk passed
+1 💚 mvnsite 2m 45s trunk passed
+1 💚 shadedclient 21m 36s branch has no errors when building and testing our client artifacts.
+1 💚 javadoc 2m 8s trunk passed with JDK Ubuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1
+1 💚 javadoc 2m 30s trunk passed with JDK Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
+0 🆗 spotbugs 1m 30s Used deprecated FindBugs config; considering switching to SpotBugs.
+1 💚 findbugs 5m 29s trunk passed
_ Patch Compile Tests _
+0 🆗 mvndep 0m 23s Maven dependency ordering for patch
+1 💚 mvninstall 2m 3s the patch passed
+1 💚 compile 20m 16s the patch passed with JDK Ubuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1
+1 💚 javac 20m 16s the patch passed
+1 💚 compile 17m 38s the patch passed with JDK Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
+1 💚 javac 17m 38s the patch passed
+1 💚 checkstyle 2m 53s the patch passed
+1 💚 mvnsite 2m 42s the patch passed
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 shadedclient 15m 34s patch has no errors when building and testing our client artifacts.
+1 💚 javadoc 2m 8s the patch passed with JDK Ubuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1
+1 💚 javadoc 2m 34s the patch passed with JDK Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
+1 💚 findbugs 5m 45s the patch passed
_ Other Tests _
+1 💚 unit 1m 13s hadoop-registry in the patch passed.
-1 ❌ unit 111m 23s /patch-unit-hadoop-hdfs-project_hadoop-hdfs.txt hadoop-hdfs in the patch passed.
+1 💚 unit 22m 5s hadoop-yarn-server-nodemanager in the patch passed.
+1 💚 asflicense 0m 54s The patch does not generate ASF License warnings.
320m 54s
Reason Tests
Failed junit tests hadoop.hdfs.TestFileChecksum
hadoop.hdfs.TestDFSShell
hadoop.hdfs.server.blockmanagement.TestAvailableSpaceRackFaultTolerantBPP
hadoop.hdfs.server.namenode.TestNameNodeMXBean
hadoop.hdfs.server.blockmanagement.TestBlockTokenWithDFSStriped
hadoop.hdfs.TestDFSInputStream
hadoop.hdfs.server.namenode.TestNamenodeCapacityReport
hadoop.hdfs.server.blockmanagement.TestBlockManager
hadoop.hdfs.web.TestWebHDFS
hadoop.hdfs.TestGetFileChecksum
hadoop.hdfs.TestFileChecksumCompositeCrc
hadoop.hdfs.server.sps.TestExternalStoragePolicySatisfier
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-2358/2/artifact/out/Dockerfile
GITHUB PR #2358
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient findbugs checkstyle
uname Linux 3c4643599c5d 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 82522d6
Default Java Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-2358/2/testReport/
Max. process+thread count 2850 (vs. ulimit of 5500)
modules C: hadoop-common-project/hadoop-registry hadoop-hdfs-project/hadoop-hdfs hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager U: .
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-2358/2/console
versions git=2.17.1 maven=3.6.0 findbugs=4.0.6
Powered by Apache Yetus 0.13.0-SNAPSHOT https://yetus.apache.org

This message was automatically generated.

@steveloughran
Copy link
Contributor

The point is that some simple logging calls are on the hot path and frequently executed. The accumulated overhead for these simple logging calls is larger than other complex logging calls rarely executed.

personally

  • I prefer the common log operations (info +) to be efficient.
  • and debug level logging to have ~0 overhead when not used.
  • but enough debug logging for me to work out what is going wrong when things don't work

@steveloughran
Copy link
Contributor

catching up on my long-neglected review homework.
we should just get this in.

@ccoder-chenzhi can you rebase this to trunk?

@coder-chenzhi coder-chenzhi force-pushed the trunk branch 2 times, most recently from ea7ff2b to f8e6423 Compare March 24, 2022 03:30
@coder-chenzhi
Copy link
Author

@steveloughran This PR is rebased to trunk and ready for merge.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 1m 10s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 1s 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 _
+0 🆗 mvndep 12m 25s Maven dependency ordering for branch
+1 💚 mvninstall 26m 2s trunk passed
+1 💚 compile 24m 42s trunk passed with JDK Ubuntu-11.0.14+9-Ubuntu-0ubuntu2.20.04
+1 💚 compile 21m 16s trunk passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚 checkstyle 3m 50s trunk passed
+1 💚 mvnsite 3m 9s trunk passed
+1 💚 javadoc 2m 34s trunk passed with JDK Ubuntu-11.0.14+9-Ubuntu-0ubuntu2.20.04
+1 💚 javadoc 2m 57s trunk passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚 spotbugs 6m 0s trunk passed
+1 💚 shadedclient 24m 29s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 23s Maven dependency ordering for patch
-1 ❌ mvninstall 0m 50s /patch-mvninstall-hadoop-hdfs-project_hadoop-hdfs.txt hadoop-hdfs in the patch failed.
-1 ❌ compile 3m 25s /patch-compile-root-jdkUbuntu-11.0.14+9-Ubuntu-0ubuntu2.20.04.txt root in the patch failed with JDK Ubuntu-11.0.14+9-Ubuntu-0ubuntu2.20.04.
-1 ❌ javac 3m 25s /patch-compile-root-jdkUbuntu-11.0.14+9-Ubuntu-0ubuntu2.20.04.txt root in the patch failed with JDK Ubuntu-11.0.14+9-Ubuntu-0ubuntu2.20.04.
-1 ❌ compile 2m 51s /patch-compile-root-jdkPrivateBuild-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07.txt root in the patch failed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07.
-1 ❌ javac 2m 51s /patch-compile-root-jdkPrivateBuild-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07.txt root in the patch failed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07.
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 3m 27s the patch passed
-1 ❌ mvnsite 0m 52s /patch-mvnsite-hadoop-hdfs-project_hadoop-hdfs.txt hadoop-hdfs in the patch failed.
+1 💚 javadoc 1m 51s the patch passed with JDK Ubuntu-11.0.14+9-Ubuntu-0ubuntu2.20.04
+1 💚 javadoc 2m 11s the patch passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
-1 ❌ spotbugs 0m 52s /patch-spotbugs-hadoop-hdfs-project_hadoop-hdfs.txt hadoop-hdfs in the patch failed.
-1 ❌ shadedclient 8m 27s patch has errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 1m 3s hadoop-registry in the patch passed.
-1 ❌ unit 0m 51s /patch-unit-hadoop-hdfs-project_hadoop-hdfs.txt hadoop-hdfs in the patch failed.
+1 💚 unit 22m 54s hadoop-yarn-server-nodemanager in the patch passed.
+1 💚 asflicense 0m 27s The patch does not generate ASF License warnings.
185m 6s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-2358/1/artifact/out/Dockerfile
GITHUB PR #2358
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell
uname Linux 03bdb40dfa39 4.15.0-153-generic #160-Ubuntu SMP Thu Jul 29 06:54:29 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / ccff4ab
Default Java Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.14+9-Ubuntu-0ubuntu2.20.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-2358/1/testReport/
Max. process+thread count 526 (vs. ulimit of 5500)
modules C: hadoop-common-project/hadoop-registry hadoop-hdfs-project/hadoop-hdfs hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager U: .
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-2358/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.

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.

3 participants