In each column, The Support Authority discusses resources, tools, and other elements of IBM® Technical Support that are available for WebSphere® products, plus techniques and new ideas that can further enhance your IBM support experience.
This just in...
As always, we begin with some new items of interest for the WebSphere community at large:
- Are you ready for IMPACT 2010? Register early and save on registration fees and hotel accommodations. IMPACT 2010 is the premier conference for business and IT leaders. Join us in Las Vegas, May 2 through 7, and learn to work smarter from the most experienced business and technology leaders in the world.
- Check out these new and updated tools for the IBM Support
- New! IBM Web Services Plug-in Analyzer for WebSphere Application Server
- Update! IBM Monitoring and Diagnostic Tools for Java – Memory Analyzer V0.5.2
- Update! IBM Monitoring and Diagnostic Tools for Java - Health Center V1.1 (the featured topic in this installment of The Support Authority.)
- Update! IBM Monitoring and Diagnostic Tools for Java – Dump Analyzer V2.2.2
- Update! IBM Monitoring and Diagnostic Tools for Java – Garbage Collection and Memory Visualizer (GCMV) V2.3
- Have you tried the IBM Support Portal yet? If not, this is a good time to start using it, because the current IBM software support pages will be replaced by IBM Support Portal in January 2010. All IBM software products are now included in the IBM Support Portal. See the Support Authority's Introduction to the new IBM Support Portal for details. Be sure to let us know what you think by sending your comments and suggestions to email@example.com.
- New! Now you can use My Notifications to stay informed of available
fixes. Follow these steps to update your subscriptions:
- Click My Notifications to manage your subscriptions.
- Select a product family (for example, WebSphere).
- Check one or more products and click Continue.
- Check Fixes under Document Types and click Submit.
- The Global User Community at websphereusergroup.org continues to grow! Check out these two new virtual user groups where you can collaborate with other “WebSpherians” from around the world:
- Do you use business process management (BPM) products? If so, check out the announcement for BPM V7.0.
- There are several exciting webcasts planned in November at the WebSphere Technical Exchange. Check the site for details and become a fan on Facebook!
Continue to monitor the various support-related Web sites, as well as this column, for news about other tools as we encounter them.
And now, on to our main topic...
IBM Monitoring and Diagnostic Tools for Java - Health Center is a new addition to IBM’s portfolio of Java diagnostic tools. This tool provides an integrated solution for detecting and diagnosing performance, capacity, and stability issues in Java applications.
Health Center can monitor any application running on an IBM Java Virtual Machine (JVM), including IBM WebSphere Application Server ) and related WebSphere products. It supports a full range of platforms including z/OS®, AIX®, Linux®, and Windows®.
Health Center collects comprehensive method profiles with an extremely low overhead, highlights contended locks, analyzes garbage collection and heap usage, and visualizes class loading activity. It also checks for command line options that could cause stability or performance problems. Health Center provides visualizations, analysis, and recommendations, which you can see in the Status view (Figure 1), displaying an overall view of the Health Center’s findings.
Figure 1. Status view
If you use WebSphere Application Server’s Performance Monitoring Infrastructure (PMI) for performance tuning, you will find that some of the same information (like heap usage) is available through both PMI and Health Center. However, there are important differences to be aware of that will help you determine when to use each tool.
The Health Center is different from PMI in that it is Java-focused and so it does not include higher level or Web application-specific metrics, such as HTTP response times and servlet request counts. Instead, it provides very detailed Java information, much of which is unavailable elsewhere. It also includes method profiles, which are extremely helpful in identifying poorly performing code or code that is being unnecessarily called. Health Center also features lock analysis for identifying synchronization bottlenecks, and a garbage collection perspective, which can spot when garbage collection is causing application slowdowns.
Installing Health Center
The Health Center agent requires a minimum Java level of 1.5 SR8 or 1.6 SR2. IBM WebSphere Application Server V7.0 ships with a version of Java that supports Health Center by default; WebSphere Application Server V6.1 must be updated with an SDK fix pack to at least Java 1.5 SR8.
Before you can use the Health Center you must set up your system for monitoring:
- Install the Health Center agent and client.
- Configure WebSphere Application Server to enable monitoring.
- Connect the Health Center client to a Java application.
The Health Center tool has two parts:
- An agent that sends information from the monitored JVM to the client.
- A client that connects to the agent and shows information about the health of the Java application.
Before an application can be monitored, the Health Center agent must be installed into the JVM it uses, and the application must be started with special command line options. JVM versions 1.5 SR9, 1.6 SR3, and newer ship with an agent by default. Prior JVMs can be upgraded using an agent available from within the client.
The Health Center client is a tool add-on for the IBM Support Assistant. Follow the instructions for how to install and run tools for the IBM Support Assistant to install the client. Select IBM Monitoring and Diagnostic Tools for Java – Health Center when asked to install or launch a tool.
After the client is installed, you can download the agent from within the client and install it into the JVM you wish to monitor. Even if you’re using the JVM that is shipped with the Health Center agent, be sure to pick up the latest agent because it will contain the latest updates and defect fixes. To do this, click the Enabling an application for monitoring link on the first page of the connection wizard (Figure 2). The IBM Support Assistant help system opens to a page that contains links to the downloadable Health Center agents (Figure 3).
Figure 2. Health Center connection wizard
Figure 3. Health Center agents
Download the appropriate agent for your platform and unzip the agent into the root directory of the target JVM. For example, in a typical Linux environment, unzip the agent into /opt/ibm/WebSphere/AppServer/java.
Configure WebSphere Application Server to enable monitoring
To enable WebSphere Application Server and your applications for Health Center monitoring, use the administrative console to adjust the JVM configuration:
- Start the administrative console.
- Select Servers => Application Servers.
- Choose the server you want to monitor.
- Scroll down to Sever Infrastructure (Figure 4).
Figure 4. Administrative console: Server Infrastructure
- Expand Java and Process Management.
- Click Process Definition.
- On the new page that opens, go to Additional Properties and click
Java Virtual Machine (Figure 5).
Figure 5. Administrative console: Additional Properties
- Scroll down to the Generic JVM arguments field, and add these
arguments (Figure 6):
Figure 6. Add arguments to the JVM Arguments field
- Save your settings and restart the application server.
The Health Center agent will try to listen on port 1972 and auto-increment if that port is in use. If there is a firewall between the Health Center client and agent, make sure that the agent’s listening port is open.
Configure your development environment to enable monitoring
After you have installed a Health Center agent and updated your WebSphere Application Server configuration, you're ready to start monitoring. To monitor an application:
- Start the IBM Support Assistant workbench.
- On the Home page, click the Analyze Problem tab.
- Select IBM Monitoring and Diagnostic Tools for Java - Health Center
from the Tools catalog and click the Launch button (Figure 7).
Figure 7. Launch Health Center
- The Connection Wizard opens (Figure 8). Click Next.
Figure 8. Connection wizard
- On theJVM Connection Details panel (Figure 9), specify the host name
you wish to connect to and accept the default port number. Click Next
to start searching for Health Center agent listening ports. By
default, the search begins with port 1972 and scans the next 100 ports
to find all listening agents. If you already know the listening port
for the agent you want to connect to, you can enter that number and
uncheck the Scan next 100 ports for available connections check box.
If there is a firewall between the client and the agents, then be sure
to open the necessary ports.
Figure 9. JVM Connection Details
- When the search completes, the final panel of the wizard shows the
available agent connections (Figure 10). Select a port from the list
and click Finish to connect.
Figure 10. Final Connection wizard panel
What's your WebSphere application really doing?
You can now look to see what your application is doing and how you can optimize it to do it faster.
For the purpose of demonstrating how you would use the Health Center to accomplish these tasks, let’s look at the Plants By WebSphere sample Web application. Follow along to see how a small change to the application can have a significant impact on performance.
The change that was made to the Plants By WebSphere application was to add a small bit of dynamic content to the Web page; specifically, the current year was added to the name of each plant that displays on the page. No changes were made to the backing database, just to the code which returns the name: Inventory.getName(). The current year was then worked out by constructing a Date object, formatted as a string, and then a regular expression was used to parse out the year. Figure 11 shows the result of these changes.
Figure 11. The updated Plants By WebSphere application
Now, let’s use Health Center to see the impact of these changes:
- How does the change impact garbage collection?
What is the performance impact of these changes? To understand this, the first thing you need to check is garbage collection. In the Garbage Collection perspective, Health Center shows graphs of garbage collection activity, GC statistics, and recommendations (Figure 12).
Figure 12. Garbage Collection perspective
As you can see from the graphs in Figure 12, the GC pauses are not excessively long, but there does seem to be quite a bit of GC activity. You can confirm this by looking at the summary, which shows 6.2% of the application's time is spent in garbage collection. Although 6.2% GC overhead isn't excessive, it's significantly higher than the 2.6% overhead of the original application (Figure 13).The rate of garbage generation is also six times higher, so the new application is generating far more garbage.
Figure 13. Summary garbage collection table for original application
- How does the change affect execution efficiency?
Next, check the percentage of the CPU consumed by using the Date object. Is it running efficiently? The Health Center’s Profiling perspective can help answer this question. Sometimes the profile can be dominated by WebSphere Application Server code and it can be hard to find your application code. To see just your code, you can use the filtering capability (Figure 14). Use regular expressions for more complex filtering (an asterisk (*) is always added to the beginning and end of the filter string, so there's no need to add wildcards for simple strings). This example uses "plant" as a filter so that only Plants By WebSphere methods are profiled.
Figure 14. Use the filtering capability in the Profiling perspective
The Health Center's Profiling perspective gives a method profile collected by regularly sampling the executing code. In this case (Figure 15), the Self (%) column shows that 3.2% of CPU time is spent in Date.toString(). The Tree (%) column shows the cumulative amount of CPU time (40.6%) is spent by Date.toString() and all of the methods that it calls. Date.toString() is responsible for more than 40% of the application's CPU usage.
Figure 15. Method profile
The invocation path view (Figure 16) shows which code is calling Date.toString(). In this case, 100% of the calls come from the changed method, Inventory.getName().
Figure 16. Invocation paths of Date.toString()
Clearly, formatting dates as strings is costly. If you were to improve performance here, you could cache the string instead of re-creating it for every item in the inventory. The profile (Figure 15) also shows that quite a lot of time is being spent in regular expression processing, so you should also cache the parsing results. Better yet, use a method of working out the date which avoids creating extra strings and regular expression matching, such as Calendar.get(Calendar.YEAR).
- How is your synchronization doing?
The code change in this example did not involve any synchronization and so there are no issues with the locking behavior of the application. Therefore, it is unlikely that synchronization will have a significant performance impact in this example (Figure 17).
Figure 17. Locking perspective
- What configuration is your application running with?
The Health Center Environment perspective (Figure 18) shows the Java configuration, system properties, and environment variables of the monitored process. This can be useful for confirming whether the intended JVM is being monitored and whether WebSphere applications are running with the intended configurations.
Figure 18. Environment perspective
IBM Monitoring and Diagnostic Tools for Java - Health Center enables you to monitor the performance and behavior of a WebSphere Application Server application in a lightweight, always-on way. It can easily and clearly help you identify and diagnose performance, configuration, and synchronization problems.
- The Support Authority: If you need help with WebSphere products, there are many ways to get it
- IBM Software product Information Centers
- IBM Software Support Web site
- IBM Education Assistant
- IBM developerWorks
- IBM Redbooks
Get products and technologies
- Forums and newsgroups
- Java technology Forums
- WebSphere Support Technical Exchange on Facebook
- Global WebSphere Community on websphereusergroup.org
- Follow IBM Support on Twitter!