Monitor and analyze runtime behavior with Code Optimizations
Code Optimizations, an AI-based service in Azure Application Insights, works in tandem with the Application Insights Profiler to detect CPU and memory usage performance issues at a code level and provide recommendations on how to fix them. Code Optimizations identifies these CPU and memory bottlenecks by:
- Analyzing the runtime behavior of your application.
- Comparing the behavior to performance engineering best practices.
Make informed decisions and optimize your code using real-time performance data and insights gathered from your production environment.
You can review your Code Optimizations in the Azure portal.
Demo video
Requirements for using Code Optimizations
Before you can use Code Optimizations on your application:
- Enable the Application Insights Profiler.
- Verify your application:
- Is .NET.
- Uses Application Insights.
- Is collecting profiles.
Application Insights Profiler vs. Code Optimizations
Application Insights Profiler and Code Optimizations work together to provide a holistic approach to performance issue detection.
Application Insights Profiler
The Profiler focuses on tracing specific requests, down to the millisecond. It provides an excellent "big picture" view of issues within your application and general best practices to address them.
Code Optimizations
Code Optimizations analyzes the profiling data collected by the Application Insights Profiler. As the Profiler uploads data to Application Insights, our machine learning model analyzes some of the data to find where the application's code can be optimized. Code Optimizations:
- Displays aggregated data gathered over time.
- Connects data with the methods and functions in your application code.
- Narrows down the culprit by finding bottlenecks within the code.
Cost and overhead
Code Optimizations are generated automatically after Application Insights Profiler is enabled. It incurs no extra cost to you as it analyzes performance issues and generates performance recommendations. Some features (such as code-level fix suggestions) require Copilot for GitHub and/or Copilot for Azure.
Supported regions
Code Optimizations is available in the same regions as Application Insights. You can check the available regions using the following command:
az account list-locations -o table
You can set an explicit region using connection strings. Learn more about connection strings with examples.
Next steps
Related links
Get started with Code Optimizations by enabling the following features on your application:
Running into issues? Check the Troubleshooting guide