open-telemetry / opentelemetry-java-instrumentation

OpenTelemetry auto-instrumentation and instrumentation libraries for Java
https://opentelemetry.io
Apache License 2.0
1.98k stars 865 forks source link

performance degradation after agent injection #10063

Closed tuhao1020 closed 11 months ago

tuhao1020 commented 11 months ago

Describe the bug

I'm using https://github.com/killme2008/aviatorscript performance degradation after agent injection

String expression = "a-(b-c)>100";
Instant start = Instant.now();
Expression compileExp = AviatorEvaluator.compile(expression);
Instant finish = Instant.now();
System.out.println("elapse: " + Duration.between(start, finish).toMillis());

before injection: about 1ms after injection: > 10ms

Steps to reproduce

String expression = "a-(b-c)>100";
Instant start = Instant.now();
Expression compileExp = AviatorEvaluator.compile(expression);
Instant finish = Instant.now();
System.out.println("elapse: " + Duration.between(start, finish).toMillis());

Expected behavior

no performance issue

Actual behavior

performance degradation

Javaagent or library instrumentation version

1.24.0

Environment

JDK: Temurin 17.0.4 OS: mac Sonoma Spring Boot 3.2.0 Aviator 5.3.3

Additional context

No response

trask commented 11 months ago

is this related to #10071?

laurit commented 11 months ago

Try with the latest version of the agent, should work a bit better.

tuhao1020 commented 11 months ago

@trask yes, I'll try IgnoredTypesConfigurer @laurit

tuhao1020 commented 11 months ago

https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/164358d78827e9b0e8d75a5e38b7f7c9a80571f8/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/ignore/GlobalIgnoredTypesConfigurer.java#L15-L24

it works