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.
Why is it that such a powerful tool is used so sparingly and only after issues are apparent? Unfortunately, most profiling tools come with significant overhead that can cause applications to run much slower. Legacy profiling tools were not designed to be continuously run in production. This means developers use profiling only when necessary and, in most cases, on local dev machines not production environments.
Now there’s a better, more accessible way to leverage the power of profiling.
Low overhead, continuous production profiling
When your process consumes more resources than you expect there is an impact to latency which can cost you money. The time of provisioning more hardware just to fight bad performance is over. You need to be able to find where CPU time is being spent so you can immediately correct the issue to improve service quality, customer experience, and reduce hardware costs. When your customer experience is on the line, you can’t afford to wait until there is a major issue to turn on a profiler. This is why Instana has created an automated and continuous production profiler designed from the ground up to have extremely low overhead. This enables developers and SREs to continuously analyze code-level performance in production without negatively impacting production applications. Profiling is no longer just for development or turned on for troubleshooting AFTER a customer impacting issue, it gives you a new perspective on your code with meaningful production load.
AutoProfile attaches itself to the running process automatically with no restarts or reconfiguration required. With Instana’s 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’.
Continuously analyze code-level performance in production 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 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 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 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.
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, a breeze.
AutoProfile for Java is immediately available in Beta for any Instana customer. Details on how to get started with Java profiling can be found in docs.