Sunday, November 11, 2018

Java Profiler List: 3 different types and why you need all of them


Debugging performance problems in production can be a pain and, in some cases, impossible without the right tools. The Java profile creators have been around for a while, but the profile creators that most developers think are just one type.

Let's dive into the 3 different types of Java profiles:

1. Standard JVM profiles that track all the details of the JVM (CPU, chaining, memory, garbage collection, etc.).

2. Light profilers that emphasize its application with a little abstraction.

3. Application performance management (APM) tools used to monitor live applications in production environments.



Standard JVM profiles

Products such as VisualVM, JProfiler, YourKit and Java Mission Control.

A standard Java profiler certainly provides most of the data, but not necessarily the most useful information. This depends on the type of debugging task. These profiler will track all method calls and memory usage. This allows a developer to immerse themselves in the call structure at any angle they choose.

pros:

• Excellent for tracking memory leaks, standard profiles detail all memory usage by JVM and which classes / objects are responsible. The ability to manually run the garbage collection and then review the memory consumption can easily highlight the classes and processes that are retained in memory with error.

• Good for tracking CPU usage, a Java profile creator generally provides a CPU sampling resource to track and add CPU time per class and method to help focus on access points.

cons:

• Requires a direct connection to the monitored JVM; This ends up limiting the use to development environments in most cases. (Note: some profile creators can work with subprocess frames and memory in limited ways).
• slow down your application; Good processing power is necessary for the high level of detail provided.

Interested in learning Java? Join now:” java training in chennai “

Lightweight transaction profiles in Java

Products such as XRebel and Stackify Prefix.

The creators of light profiles adopt a different approach when tracking their application, injecting themselves directly into the code.

• Aspect Profilers uses aspect-oriented programming (AOP) to inject code at the beginning and end of the specified methods. The injected code can start a stopwatch and report the elapsed time when the method is completed. These profiler are simple to configure, but you need to know what to create. For example, see Creating the profile of the Spring AOP method.

• Java Agent profile creators use the Java instrumentation API to inject code into their application. This method has greater access to your application, since the code is rewritten at the bytecode level. This allows any code that runs in your application to be instrumented - either the code you wrote or the third-party libraries that the application depends on. Check the introduction to the Java agents to see how everything works.
Aspect profilers are very easy to configure, but they are limited in what they can monitor and are overloaded by detailing everything you want to track. Java agents have a great advantage in their tracking depth, but they are much more complicated to write.
The Stackify Prefix is a developer-oriented Java profile creator using the Java agent profile method behind the scenes. The interesting thing is that Prefix already knows the most desired classes, and developers of third-party libraries want to be instrumented. So you do not need to detail all of them. In addition, it takes all the instrumentation statistics and displays them in a simple and understandable way. For example, when running an application using Hibernate, the Prefix not only details the elapsed time for queries, but also displays parameter values for the generated SQL. When your application calls a SOAP / REST API, the Prefix provides the content of the request and the response.

Interested in learning Java? Join now:” java training in bangalore

Low Overload, Creating Java JVM Profile in Production (APM)

APM tools like New Relic, AppDynamics, Stackify Retrace, Dynatrace.
All profilers have been optimal for development so far, but monitoring how your system works in production is critical. Production is always a different landscape - the development and preparation configurations usually do not have the same data sets and load.

Java APM tools generally use the Java Agent profile creator method, but with different instrumentation rules to allow execution without affecting performance in productions. The trick with these proflets is to provide the correct information in a smart way so as not to occupy the CPU cycles.

Why are some Java profiles so expensive?

XRebel is a legal tool, but it costs US $ 365 per year. The Stackify Prefix is free and provides much of the same functionality.
The biggest problem with APM solutions is definitely its price. Traditionally, they are so expensive that only the largest companies can deal with them. It does not make much sense to spend $ 100 a month on a server in Azure or AWS and spend another $ 200 a month for a product like the new relic.The monitoring tools should not cost more than the servers!



No comments:

Post a Comment

From Java 8 to Java 11

Switching from Java 8 to Java 11 is more complicated than most updates. Here are some of my notes on the process. Modules Java 9 i...