Good application design and development practices are critical to ensuring satisfactory application performance. Data reads or writes and processing by your applications may cause performance bottlenecks due to factors such as timeouts on remote servers memory allocation or network issues among other factors. Understanding how each application works is therefore crucial in identifying performance bottlenecks. Setting expected time duration each code part is expected to take can help develop realistic benchmarks against which the applications can be reviewed. These benchmarks should take into account high and low peak usage times for the applications and not averages as these may highly vary from the peak times.
In addition, using benchmarking tools to test your applications may be a quick way to pinpoint issues in your code which can often be causes for performance bottlenecks. Iterative tests are recommended to identify cache and other hardware issues that may arise due to start up or other factors.
The JBoss Enterprise Web Platform web console, http://localhost:8080/web-console/, provides you with monitoring tools starting with the JVM environment statistics on the default page and access to monitoring tools and snapshots.
Performance Monitors and Profilers
A performance monitor informs you on overall application performance such as requests per second. Profiling tools such as JBoss Profiler will tell you how long it is taking your application to service a request, and how often it services certain types of requests. This can usually be broken down all the way to the individual methods. For example, how many times a method was called and the average/maximum/minimum amount of time spent in the method.
It is also important not to create bottlenecks for other applications while fixing a performance issue in one application.
Applications should be instrumented for performance analysis. In most cases, the actual production workload differs from the expected workload. Without instrumentation of your applications, you will lack accurate tracking data. Workloads on your applications can also change over time, as the business size, models or environment changes.
In the past, instrumentation had to be embedded in the application. Today, there are many solutions for instrumentation that do not require developers to code. Commercial products, and the JBoss AOP framework can be used for just this purpose. You can also turn on call statistics in the containers, and Hibernate statistics. For more on this please refer to the AOP and Hibernate project pages.
Taking successive thread dumps (includes the current call stack for each Java Enterprise Web Platform thread) can show application developers what is happening in the application. If an application has hit a performance wall, and the performance issue lasts for five minutes, generating a thread dump every minute may help solve the problem. You can use the JVM
jps -l command to get a list of running Java applications and the process IDs for each. Note the process ID for the org.jboss.Main application. Then run the jstack ProcessID command (replacing ProcessID with the org.jboss.Main process ID) to generate the thread dump. Of course, you should redirect the output of the jstack command to save the output: jstack ProcessID > threaddump1.txt.