★ wanayoo — archive 1999 https://github.com/graphql-java/graphql-java/issues/1929Nouvelle recherche | Portail wanayoo
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

Protect logging debug calls with isDebugEnabled to avoid performance penalties #1929

Open
fvilla-amazon opened this issue May 27, 2020 · 1 comment
Milestone

Comments

@fvilla-amazon
Copy link
Contributor

@fvilla-amazon fvilla-amazon commented May 27, 2020

Describe the bug
Usually, debug logging is not enabled in production deployments. Sometimes the fields passed to debugging calls can take time to evaluate in order to utilize them in a debug message. These include resolving lists and maps to strings and , in some cases, certain get class name methods like getSimpleName, etc. In our usage of log4j, we found that some implementations offer lambda support to ensure that arguments used in the log4j calls are only evaluated if the debug level used is enabled. However, it looks like the logging implementation that graphql-java uses does not support this capability.

In performance testing our own GraphQL service, we found that relying on the logging implementations log level check was not enough because the method call still needs to evaluate the arguments passed to the Logger.debug method which incurs a cost.

To avoid any potentially incurred latency or performance degradation due to debug logging, all debug logging statements should be protected with isDebugEnabled.

To Reproduce
N/A

fvilla-amazon added a commit to fvilla-amazon/graphql-java that referenced this issue May 27, 2020
Description:
Protect against potential performance degradation from debug logging by
utilizing the logging libraries isDebugEnabled() check directly.

Changes:
* Protected all Logger.debug(...) calls with Logger.isDebugEnabled()

Unit Tests:
* N/A
bbakerman pushed a commit that referenced this issue Jun 7, 2020
Description:
Protect against potential performance degradation from debug logging by
utilizing the logging libraries isDebugEnabled() check directly.

Changes:
* Protected all Logger.debug(...) calls with Logger.isDebugEnabled()

Unit Tests:
* N/A
@bbakerman
Copy link
Member

@bbakerman bbakerman commented Jun 8, 2020

Thanks for the PR

@bbakerman bbakerman added this to the 16.0 milestone Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.