Profiling Java Applications in Production Environments

The DevOps and SRE practices allow teams to achieve faster production problem resolution by encouraging collaboration and deeper understanding of the applications. This implies that the necessary production analysis tools are available.

Profilers are essential in optimizing and troubleshooting application performance; they provide code-level statistics on application execution. However, traditional profilers are mostly available for development environments. They should be manually attached to the applications locally or remotely and almost always have a very high overhead.

The problems usually manifest themselves in production environments. One reason is that the scale and the data are different in production, which are main causes of performance problems. Therefore, to find the root cause of a problem the application state should be reproduced locally on a developer machine or test environment, which is often impractical and sometimes even impossible.

With production profilers for Go, Node.js, Python and Java, StackImpact helps developers and operations teams to analyze performance problems as well as potential optimization spots directly in production and cloud environments. Skipping the problem reproduction step can significantly reduce MTTR and stimulate continuous performance improvements, leading, among other things, to infrastructure cost saving.

Using StackImpact Java profiler

There are two ways to integrate StackImpact Java agent into the application; using -javaagent option and an API. The API option allows you to include and initialize the agent just like any other third party library, without the need to modify any Java options. This is instrumental when profiling cloud and serverless applications.

See the documentation for detailed setup instructions.

After the application is started, the agent will start profiling the application automatically with low-overhead. The profiles will be sent to the Dashboard, where a timeline of various profiles can be analyzed at any time.

Screenshot

The Java agent currently supports CPU and lock profiling. It additionally reports JVM health metrics for CPU, memory, garbage collection, and more.