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.
Answer the questions that follow:
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.
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).
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.
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.