Analyze Profiles

A profile, according to wikipedia, “is a form of dynamic program analysis that measures, for example, the space (memory) or time complexity of a program, the usage of particular instructions, or the frequency and duration of function calls”. With that, a profiler is a program to generate such a profile for the purpose of immediate or later analysis.

In most instances, a profiler is used by developers to identify performance issues or bottlenecks in their code. Profilers are designed to enable developers to dig all the way down to the individual line of code that is running slow, or is resource intensive. As powerful as profiling can be to identify code optimization opportunities, it is often only used by developers in dev environments after there is already a serious issue. Even if a developer wanted to run profiling in production, it can be difficult at best to get access to production to get a profiler attached.

Instana AutoProfile™ attaches itself to the running process automatically with no restarts or reconfiguration required. With AutoProfile, users are able to continuously analyze code-level performance, discover bottlenecks in production code, visualize performance with a flame graph, and dig deep into the application’s ‘hot paths’.

To investigate profiles go to Unbounded Analytics view and then switch to "Profiles".

Continuously analyze code-level performance in production

profile processes

AutoProfile automatically and continuously profiles how your code runs in production, with no configuration required. AutoProfile is designed to uncover bottlenecks in your code and report CPU and contention profiles. CPU profiles allow developers to discover which method is CPU intensive so they can efficiently and precisely optimize their code. Contention profiles show which synchronized directives are causing long wait times, inefficient use of the CPU’s multithreading capabilities and leading to bad overall performance.

Visualize as a flame graph

flame graph

AutoProfile visualizes all profiles as a flame graph making it easy to see exactly where resources are being consumed. The flame graph bars are sized according to the amount of resources consumed. Additionally, the graph is ordered chronologically from the top down. Instana augments the profiles with valuable metrics like CPU usage and GC activity. To provide you with the context needed to understand the impact of the profile.

Find the ‘hot path’ in the tree view

hot path

Instana provides a tree view of all profiles, simply click on the plus sign to expand the area of interest. This makes it quick and easy to find the ‘hot path’ in your code. For example, you can quickly click on profiles to expand a path that shows you what code is using thirty percent of the total CPU usage so you can improve and optimize your code.

Dive in to the code (Java only)

dive in code

Open up the exact code that is causing the issue from either the flame graph or the tree view. You can filter by your package or class name to quickly find where your code starts in the code path. Simply click the link to dive directly into the line of code you need to focus on.

profiling code

Instana’s AutoProfile fits perfectly within Instana’s best-in-class performance optimization capabilities. AutoProfile and Unbounded Analytics™ provide developers with all of the information needed at their fingertips to immediately find the root cause of any issue or resource contention. This makes optimizing the performance of applications and services, to provide the best possible customer experience.

Profile types

Profiling capabilities depend greatly on the languages, runtimes and versions. Due do implementation differences of sampling mechanisms and tooling, profile types and their availability differs across languages and runtimes. Currently supported profile types are summarized in the tables below.

In terms of structure, profiles are similar. They consist of code execution paths often represented in a call graph or a call tree with some statistic for each node, e.g. number of hits, kilobytes or milliseconds. A code path is a trace of method calls similar to an exception stack trace.

Java profiles

Profile type Description
CPU usage CPU profiles show CPU usage per code path. CPU profiler works by statistically sampling process execution.
Contention Contention profiles show where the synchronized code is waiting for other threads. The aggregation of wait time is done per code path.

Node.js profiles

Profile type Description
CPU usage CPU profiles show CPU usage per code path. CPU profiler works by statistically sampling process execution.
Async calls Async call profiles show an aggregated view of asynchronous call waits for code paths, where these async calls are made.
Memory allocation rate Memory allocation rate profiles show how much memory was allocated per unit of time aggregated by code paths, where the allocation was made.

Golang Profiles

Profile type Description
CPU usage CPU profiles show CPU usage per code path. CPU profiler works by statistically sampling process execution.
Blocking calls Blocking call profiles show an aggregated view of blocking calls, i.e. calls waiting for an IO, channel, etc., per code path.
Memory allocation Memory allocation profiles show current memory usage by code path, where the allocation was made.

Python profiles

Profile type Description
CPU usage CPU profiles show CPU usage per code path. CPU profiler works by statistically sampling process execution.
Blocking calls Blocking call profiles show an aggregated view of call waits per code path.
Memory allocation rate Memory allocation rate profiles show how much memory was allocated per unit of time aggregated by code paths, where the allocation was made.

PHP profiles

Profile type Description
CPU usage CPU profiles show CPU usage per code path. CPU profiler works by statistically sampling process execution.

Ruby profiles

Profile type Description
CPU usage CPU profiles show CPU usage per code path. CPU profiler works by statistically sampling process execution.