Wednesday, November 14, 2018

Java performance tools

Performance tools for Java

Accompanying the performance of your application is a continuous task, so it is important to have the right tools. What works in the development may not be so useful in a production environment. Here, I'm going to talk about the best tools and the best time to use them. The goal is to help you create reliable, high-performance applications as quickly as possible.

1. Java Profilers

JVM profiles offer a ton of raw data by tracking all method calls, allowing you to find CPU access points and memory consumption. A good test of size is to configure an Apache JMeter job to reach an endpoint that is developing a few thousand times while it is linked to a profile creator. This allows you to specify the memory and CPU requirements for production.

Pros: optimal for tracking memory leaks, the ability to manually run the garbage collection and then review the memory consumption can easily highlight the classes and processes that are kept in memory by mistake.

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).

2. Tracking web requests and transactions in Java

The standard profile creators focus on the performance of all methods throughout the application. These tools focus on the performance of individual requests or transactions on the web.

The prefix provides deep-level performance details about your application. Including ORM calls with generated SQL, SOAP / REST API calls and tracking details of the most used third-party libraries and structures.

XRebel is configured by a Java agent in the container of the web application and provides an overlay in the application that provides details about the current request.

Pros: these tools give order to the large amount of data available in a profiler of the JVM. By helping you track the flow of a request, you can see what types of method calls are responsible for your response time.

Cons: Designed only for the development cycle. The quality control and production environments require an APM solution.

3. Java Application Performance Management (APM)

Application performance management (APM) tools assume the task of tracking all requests in a production system. The trick of these proflets is to provide the correct information intelligently so as not to impact production performance. This is done by adding time statistics and sampling traces. This gives you visibility of the level of the method for your code that is running in production.

Pros: The ability to monitor your most critical environment: Production. Identify the problems before going into production, monitoring the QA / Staging. Debug production by analyzing traces and exceptions. Summaries added to see highly used requests to help focus development time.

Cons: normally expensive to run on all the quality control / preparation and production servers. Some tools do not support asynchronous queries or do not fit correctly and slow down your application.


4. Real user monitoring (RUM)

It is not uncommon for webapps to be very dependent on the client's side; The provision of an interactive experience may require many dependencies, such as JavaScript / CSS structures, Web sources and images.

RUM provides information on the dependencies of your application, giving visibility to the download of resources and the time of representation of the page.

Some APM products include this as an additional resource. There are also independent products, such as Google PageSpeed.

5. Performance Metrics of the JVM

JVM provides a wealth of valuable information, such as garbage collection, memory usage, and thread counts. This data is available through JMX.

Stackify Retrace provides monitoring of JVM metrics through application monitors and automatically applies intelligent patterns based on the type of application discovered.

Pros: Available in any application that runs in JVM and easy to connect with applications such as JConsole.

Cons: It can be difficult to connect in a preparation and production environment. Aggregation and comparison of data can be time consuming. The statistics are collected only while the monitor is connected to the JVM.

6. Access logs to the Web server (Apache / Nginx)

If you have Apache or Nginx proxy requests for your Java application server, you can monitor the access records. This is a quick way to see how long applications are being made. You can add access logs to see which are the most popular / fastest / slowest endpoints. Doing this through the command line may take, however.

For small data sets, you can use a desktop tool such as Apache Viewer, but for preparation and production environments, a hosted registry solution is ideal.

The tracking of failed requests is also very useful, which can be done by aggregation in HTTP response codes.

Pros: quick way to get some simple statistics, by following the access records, or - if more information is needed - push a log analyzer.

Cons: does not provide details about why the request took so long. There is a lack of POST data and response content that can help pinpoint the cause of a performance problem.

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

7. Accompanying all Java exceptions

One of the biggest causes of performance problems may be application exceptions. When an exception is thrown, it causes the segment to stop while collecting the stack trace. Even manipulated exceptions that seem innocent can cause huge performance bottlenecks under heavy server load. It is important to add and monitor all your exceptions to find critical problems, new errors and monitor error rates over time.

Pros: Easy to configure, if you are using a registration structure, such as Log4j or Logback.

Cons: None

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

8. Memory analysis

The memory analysis of the application after a failure can help identify the cause of a memory leak. You can instruct JVM to dump the heap in an OutOfMemoryErrorexception including the following argument in JVM:

-XX: + HeapDumpOnOutOfMemoryError

The heap dump file can be loaded into an analyzer - Eclipse MAT. You can immerse yourself in the Overview or Leaks Suspects reports to help identify the cause of the memory exception.

Conclusion on Java performance tools

The big conclusion is that creating and maintaining the performance of the Java application is easier than ever with all these tools. Do not be overloaded with all the things you should do. Start with the fruit hung first, as a follow-up to the exception. It is really good, at least, to know what options are available to you, and I hope you have found this list useful.



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...