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

Lettuce plugin causes CPU load to surge #12923

Open
oliver-zhang opened this issue Dec 19, 2024 · 6 comments
Open

Lettuce plugin causes CPU load to surge #12923

oliver-zhang opened this issue Dec 19, 2024 · 6 comments
Labels
bug Something isn't working needs author feedback Waiting for additional feedback from the author

Comments

@oliver-zhang
Copy link
Contributor

Describe the bug

We have a Java application that uses the Lettuce component to operate Redis. When we use OpenTelemetry JavaAgent to collect traces, we find that the CPU usage increases significantly. When we remove the Lettuce plugin, it returns to normal.
The screenshot of using jstack to find the thread that consumes the most CPU is as follows
20241219102502

Steps to reproduce

  1. start app without javaagent -> cpu usage normal
  2. start app with javaagent -> cpu usage increases significantly
  3. start app with javaagent but exclude lettuce plugin -> cpu usage normal

Expected behavior

cpu usage normal

Actual behavior

CPU usage increases significantly

Javaagent or library instrumentation version

javaagent: 2.2.0 lettuce: 5.0.4 spring-data-redis: 2.1.5

Environment

JDK: 1.8
OS: centos

Additional context

No response

@oliver-zhang oliver-zhang added bug Something isn't working needs triage New issue that requires triage labels Dec 19, 2024
@steverao steverao removed the needs triage New issue that requires triage label Dec 19, 2024
@steverao
Copy link
Contributor

When we remove the Lettuce plugin, it returns to normal. The screenshot of using jstack to find the thread that consumes the most CPU is as follows

From your description, it can't be proved that the overhead is from Lettuce instrumentation of OTel Java Agent. The screenshot of jstack doesn't contain any OTel packages. You can compare the overheads by disabled and enabled Lettuce instrumentation.

@oliver-zhang
Copy link
Contributor Author

oliver-zhang commented Dec 19, 2024

When we remove the Lettuce plugin, it returns to normal. The screenshot of using jstack to find the thread that consumes the most CPU is as follows

From your description, it can't be proved that the overhead is from Lettuce instrumentation of OTel Java Agent. The screenshot of jstack doesn't contain any OTel packages. You can compare the overheads by disabled and enabled Lettuce instrumentation.

Thans for reply, I did come to this conclusion by disabling and enabling the lettuce plugin package. When we remove the Lettuce plugin, it returns to normal

@trask
Copy link
Member

trask commented Dec 19, 2024

from the screenshot it looks like there's an IndexOutOfBoundsException (creating exceptions is expensive because of walking the stack and creatiung the stack trace)

does this IndexOutOfBoundsException only occur when the lettuce instrumentation is enabled? if so, that could point to a bug in the lettuce instrumentation

@oliver-zhang
Copy link
Contributor Author

Looking at the lettuce plugin code, I found that the lettuce CommandArgs.toCommandString method is called when taking statment.

@oliver-zhang
Copy link
Contributor Author

oliver-zhang commented Dec 19, 2024

does this IndexOutOfBoundsException only occur when the lettuce instrumentation is enabled? if so, that could point to a bug in the lettuce instrumentation

Yes

@laurit
Copy link
Contributor

laurit commented Dec 19, 2024

@oliver-zhang would it be possible to provide a minimal sample application that reproduces the issue so we could debug what exactly causes it.

@laurit laurit added the needs author feedback Waiting for additional feedback from the author label Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs author feedback Waiting for additional feedback from the author
Projects
None yet
Development

No branches or pull requests

4 participants