Performance problems diagnosis in Java applications

Official Content

A performance problem in a Java application can have several causes, so the first thing to do in this case is to identify the reason why the application is having this problem - this can be the most difficult step.

Once the cause of performance deterioration is determined, solving the problem is usually much easier.
The purpose of this document is to briefly examine different ways to face performance problems, and alternatives to help diagnose their cause.

First of all let's see What do we talk about when we talk about performance.

Focusing on the problem

Answer the questions that follow:

1. Is the application deteriorating as a whole? Or is the problem limited to a certain part of the application?

In the second case, look for mistakes in the program's logic (read the navigation report of that part of the application so see if it's doing any full scan).
Look for any peculiarities of the web panel, procedure or web transaction which has the problem.

If you cannot identify a specific part of the application which is causing the performance deterioration, go on reading the following.

2. Can the performance deterioration be translated to "bad response time" of the application? Is the application having a progressive deterioration, or does it always behave the same way?

If it´s a general problem (it always behaves the same and it doesn't deteriorate as times passes), first of all discard platform and technical problems of infrastructure, bandwidth, application server and database server resources, etc.

The resources have to be administered according to the application characteristics and the number of concurrent users. Take into consideration setting minimum / maximum heap size (-Xms, -Xmx java system properties).

In most cases you should also set the size of the Permanent Generation (-XX:MaxPermSize). For detailed information see Java HotSpot VM options.

If the application deteriorates with time, it can be a symptom of a memory leak (see Troubleshooting: How to diagnose a memory leak).

3. Is the database server the one which has to be restarted?

It could be a database bottleneck.

Monitor the database server. See if the database doesn't respond after a period of time. In that case, look for possible locks in the database, long running SQL sentences, inadequate connection pool adjustment, etc.
It could be necessary that you monitor the application at the database level in order to know the variables related to the connections pool, users, cursors, statements, procedures, etc.

See Application Monitoring and Management for more details.

4. Does the application server go down with an error, and / or does it have to be restarted because its response time isn't acceptable as time passes? How periodically is the problem detected?

Read the application server logs. The Possible errors detected in the logs are: 

  •  java.lang.OutOfMemoryError: PermGen space
             See Sac #21370
  • java.lang.OutOfMemoryError: JavaHeap space

 In the second case, see Troubleshooting: How to diagnose a memory leak.

See Also

Monitoring Java applications


Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.