opentelemetry-dotnet-instrumentation icon indicating copy to clipboard operation
opentelemetry-dotnet-instrumentation copied to clipboard

longer response time of the first request than expected (1 cpu only)

Open muhaook opened this issue 2 years ago • 4 comments

the sample application was running on IIS. env info:

  • Windows Server 2022
  • CPU: 1 Core, 2 logical processors, base speed 2.19GHz
  • Memory: 12GB

The sample I was using is a pretty simple WebApiCore helloworld. but it still took 4-5 sec to get reponse from the very first request. It is likely because of the poor CPU on my VM.

after install otel-auto-instrumentation with enabled bytecode instrumentation and source instrumentation, I found the first request became slower. it took about 14 sec to get the response.

When I disabled bytecode instrumentation but enabled .NET source instrumentation using DOTNET_STARTUP_HOOKS, the response time was about 7 sec.

Below is what I did to disable bytecode instrumentation but enable .NET source instrumentation:

#COR_ENABLE_PROFILING=1
#CORECLR_ENABLE_PROFILING=1
DOTNET_STARTUP_HOOKS=c:\tracer-home\net\OpenTelemetry.AutoInstrumentation.StartupHook.dll

Here are details:

all enabled on otel-auto-instrumentation:

enableAll logs: logs_enableAll.zip

enabled source instrumentation only:

enableSourceInstumentatOnly logs: logs_enableSourceInstrumentOnly.zip

disabled otel-auto-instrumentation

disabled

The sample I was using: WebApiStartup.zip

muhaook avatar Mar 08 '23 17:03 muhaook

I used the same app to test the behavior and could not reproduce it. For StartupHook Auto-Instrumentation it takes ~600 to ~700 ms which is acceptable.

Without Instrumentation
2023-03-29 18:48:25 ::1 GET /api/hello - 8091 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/111.0.0.0+Safari/537.36 - 200 0 0 693

Auto-Instrumentation with StartupHook
2023-03-29 18:39:25 ::1 GET /api/hello - 8091 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/111.0.0.0+Safari/537.36 - 200 0 0 1259

Auto-Instrumentation with CLR Profiler
2023-03-29 18:45:07 ::1 GET /api/hello - 8091 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/111.0.0.0+Safari/537.36 - 200 0 0 2202

rajkumar-rangaraj avatar Mar 29 '23 19:03 rajkumar-rangaraj

Removing 0.7.0 milestone to revisit on the next SIG meeting how to handle this case. @rajkumar-rangaraj, do you have any recommendation?

Kielek avatar Apr 17 '23 06:04 Kielek

SIG meeting: @muhaook, we do not want to investigate only 1 cpu issue right now. If you have any other steps to reproduce, could you please share? Otherwise we will postpone after 1.0 relase.

Kielek avatar Apr 26 '23 16:04 Kielek

@Kielek , i do not think this is a big issue. it is unlikely that PROD env has only 1 CPU. please feel free to postpone or close this issue.

muhaook avatar Apr 27 '23 09:04 muhaook