Sagar
Sagar

Reputation: 710

Does enabling Azure App Insight telemetry from ASP.NET MVC & C# code have any performance side effects?

Does enabling Azure App Insight telemetry from C# code have any performance side effects?

  1. I have referenced Azure App Insight NuGet package in my ASP.NET MVC project
  2. After installing app insight NuGet package it automatically add few entries into web.config and package.config etc
  3. In App_start and begin_request events of ASP.NET MVC, I have added code to log tenant id and userid in app insight (custom dimensions)
  4. Checked-in my code and deployed to Azure Web app through CI\CD
  5. I have enabled Dynatrace extension for Azure web app
  6. In Dynatrace it shows that App insight telemetry is impacting performance of application

Question: is it possible that App Insight telemetry logging can affect performance of ASP.NET MVC app?

I un-installed App Insight telemetry logging and custom dimensions logging and as per Dynatrace, we found some performance gain

Upvotes: 0

Views: 209

Answers (1)

Harshitha
Harshitha

Reputation: 7297

As per the MSDoc,

The instrumentation monitors your app and directs the telemetry data to an Application Insights resource by using a unique token. The effect on your app's performance is small.

  • There will be some change in the performance, but the impact will be less on the App when we have Configured/Enabled Application Insights from code.

  • Instead of tracking all the logs, try to reduce the traces by setting the appropriate logging configuration.

  • We can use sampling for the WebApp to have control on the traces to be logged.

  • When we configure Application Insights from Connected Services, by default all the packages related to Application Insights will be Installed.

.csproj file:

 <Reference Include="Microsoft.AI.Agent.Intercept, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
   <HintPath>..\packages\Microsoft.ApplicationInsights.Agent.Intercept.2.4.0\lib\net45\Microsoft.AI.Agent.Intercept.dll</HintPath>
 </Reference>
 <Reference Include="Microsoft.AI.DependencyCollector, Version=2.15.0.44797, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
   <HintPath>..\packages\Microsoft.ApplicationInsights.DependencyCollector.2.15.0\lib\net452\Microsoft.AI.DependencyCollector.dll</HintPath>
 </Reference>
 <Reference Include="Microsoft.AI.PerfCounterCollector, Version=2.15.0.44797, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
   <HintPath>..\packages\Microsoft.ApplicationInsights.PerfCounterCollector.2.15.0\lib\net452\Microsoft.AI.PerfCounterCollector.dll</HintPath>
 </Reference>
 <Reference Include="Microsoft.AI.ServerTelemetryChannel, Version=2.15.0.44797, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
   <HintPath>..\packages\Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.2.15.0\lib\net452\Microsoft.AI.ServerTelemetryChannel.dll</HintPath>
 </Reference>
 <Reference Include="Microsoft.AI.Web, Version=2.15.0.44798, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
   <HintPath>..\packages\Microsoft.ApplicationInsights.Web.2.15.0\lib\net452\Microsoft.AI.Web.dll</HintPath>
 </Reference>
 <Reference Include="Microsoft.AI.WindowsServer, Version=2.15.0.44797, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
   <HintPath>..\packages\Microsoft.ApplicationInsights.WindowsServer.2.15.0\lib\net452\Microsoft.AI.WindowsServer.dll</HintPath>
 </Reference>
 <Reference Include="Microsoft.ApplicationInsights, Version=2.15.0.44797, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
   <HintPath>..\packages\Microsoft.ApplicationInsights.2.15.0\lib\net46\Microsoft.ApplicationInsights.dll</HintPath>
 </Reference>
 <Reference Include="Microsoft.AspNet.TelemetryCorrelation, Version=1.0.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
   <HintPath>..\packages\Microsoft.AspNet.TelemetryCorrelation.1.0.8\lib\net45\Microsoft.AspNet.TelemetryCorrelation.dll</HintPath>
 </Reference>
  • Check and try to remove the packages which you are not using.

  • Removing the unnecessary packages will help in improving the performance.

Upvotes: 0

Related Questions