Application profiling is an analysis technique used to collect runtime data and detect application problems such as memory leaks, performance bottlenecks, excessive object creation, and exceeding system resource limits. Rational® Application Developer Version 7.5, an integrated development environment (IDE) for Enterprise Application development, is a popular choice for developing large applications for eventual deployment on WebSphere® Application Server. Rational Application Developer gives you the ability to profile Java™ applications, providing insight into the performance and memory characteristics of your application.
Two types of profilers can be used on an application:
- Java Profiler. The Java Profiler is a standards-based Java application profiler tightly integrated into the Eclipse development workflow. The Java Profiling Agent provides detailed information about the runtime behavior of either standalone applications or applications running on an application server. It is an agent instance that is deployed with the Agent Controller.
- J2EE Request Profiler. The J2EE Request Profiler is an agent that resides within the application server process for the purpose of collecting data from the interception points of the e-business application's requests. It uses Agent Controller to externalize this data so that it can be rendered by the various views provided by the Profiling and Logging perspective of the workbench. The J2EE Request Profiler provides higher-level data about the application.
Knowing more about your application's run-time behavior provides a better understanding of its resource requirements and potential bottlenecks that can occur at runtime. Profiler aids problem determination and provides useful insights on the parameters to be tuned for better performance of the application.
This article is for developers, performance tuning specialists, or consultants. It describes the process of profiling applications running on WebSphere Application Server Version 8.0 using the profiling features of Rational Application Developer Version 7.5. The steps to configure an external Application Server instance with the Rational Application profiler are different from the steps needed if the application is integrated with Rational Application Developer.
This article assumes the following prerequisites:
- You must be familiar with Rational Application Developer and have used it as a development tool.
- You need to have a good understanding of the Application Server environments and creation profiles.
- You need to have hands-on experience in configuring Application Server and performing administrative activities.
The system requirements are:
- Microsoft® Windows®
- Rational Application Developer Version 7.5 (IBM Rational Agent Controller is packaged in the Application Developer install image and therefore no separate installation step is required.)
- WebSphere Application Server Version 8.0 ND and a Cell profile (Dmgr01 and AppSrv01 federated to it)
As shown in Figure 1, Rational Application Developer can run on a separate machine from WebSphere Application Server, or on the same machine. This article describes how to connect to and enable profiling when the target WebSphere application server instance is on a local or remote machine (not a WebSphere test environment integrated with Rational Application Developer).
Figure 1. Machine setup for application profiling
Set the environment variables
The following directories are used as the installation paths for the components.
- Agent Controller root:
- Application Server root:
- Rational Application Developer root:
Before you start Application Server and Rational Application Developer, you must set certain environment variables on the machine where the target application is running, .
- Edit the
C:\IBM\WebSphere\AppServer\profiles\AppSrv01\binby adding the statements in Listing 1 at the end of the file.
Listing 1. Setting environment variables
SET TPTP_AC_HOME=C:\IBM\SDP_1\AgentController SET JAVA_PROFILER_HOME=%TPTP_AC_HOME%\plugins\org.eclipse.tptp.javaprofiler SET PROBEKIT_HOME= \ C:\IBM\SDPShared\plugins\org.eclipse.hyades.probekit_4.2.400.v200809010100\os\win32\x86 SET BOOT_LOADER= C:\IBM\SDPShared\plugins\ org.eclipse.tptp.platform.jvmti.runtime_4.4.200.v200809010100\agent_files\win_ia32 SET LD_LIBRARY_PATH= \ %TPTP_AC_HOME%\bin;%TPTP_AC_HOME%\lib;%PROBEKIT_HOME%;%LD_LIBRARY_PATH%;%BOOT_LOADER% SET PATH= \ %TPTP_AC_HOME%\bin;%TPTP_AC_HOME%\lib;%PROBEKIT_HOME%;%JAVA_PROFILER_HOME%;%PATH%
- Save and close the
Configure WebSphere Application Server
You need to configure the Application Server so that the Rational Application Developer Profiler can attach to it.
- Start the Deployment Manager. Open a command prompt and navigate to
C:\IBM\WebSphere\AppServer\profiles\Dmgr01\bin(where Dmgr01 is the deployment manager profile in our example). Enter the command
Figure 2. Start the deployment manager
- Start the node agent. Navigate to
C:\IBM\WebSphere\AppServer\profiles\AppSrv01\bin(where AppSrv01 is the node in our example). Enter the command
Figure 3. Start the node manager
- Stop the AppSrv01 by navigating to
C:\IBM\WebSphere\AppServer\profiles\AppSrv01\binand entering the command
- Launch the Administrative console of Dmgr01 by opening a browser and
navigating to the following address on the Application Server machine:
The application server must be started with profiling enabled. In the Administrative Console, navigate to Servers > Server Types > WebSphere application servers > server1> Java and Process Management > Process definition > Java Virtual Machine.
For profiling with Java Profiling Agent, enter the following in the Generic JVM arguments field:
See Generic JVM arguments for more information.
Figure 4. Enabling the Java profiling agent
For profiling with J2EE Request Profiler, enter
Figure 5. Enabling the J2EE Request profiler
Click OK and Save configuration changes.
- Start server1. Open a command prompt and navigate to
C:\IBM\WebSphere\AppServer\profiles\AppSrv01\bin. Enter the command
Figure 6. Starting the application server
When the Generic JVM arguments field is set for the Java Profiling agent, the server start appears hung (Figure 6) because it is waiting for a signal from Rational Application Developer in this "controlled" profiling mode. Proceed to the next step.
Configure the profiler in Rational Application Developer
The next step is to configure the Rational Application Developer profiler. Perform these steps on the machine where Rational Application Developer is installed.
Configure and start the Agent Controller.
- Open a command prompt and navigate to
C:\IBM\SDP_1\AgentController\bin. Run the
SetConfig.batscript to generate the configuration file for the Agent Controller
- The Agent Controller can be started as an application or as a
Windows Service. To start as an application, enter the command
- Open a command prompt and navigate to
- Start Rational Application Developer. In a command window navigate to
C:\IBM\SDPand enter the command
Once the program has been started, go to the Profiling Perspective. To open this perspective:
- Click Window > Open Perspective > Other...
- Select Profiling and Logging from the list and click OK.
Figure 7. Profiling and logging perspective
Attach to a Remote Java process for the server instance:
- Select Run > Profile Configurations.... In the configuration window double-click Attach to Agent and click New_configuration.
- Enter a name for your configuration.
- On the Host tab, in the Default Hosts section, select the
address of the local host--for example,
localhost. If you are configuring on a remote server, enter the hostname or IP address of the remote machine. Click OK.
- Click Test Connection to verify that the
communication works. If the connection fails, check if the
Agent Controller is running using the default port.
Figure 8. Test the connection
- Next select the Agents tab. If you had set
the JVM arguments for Java Profiling agent earlier, then the
agent Java Profiling -- JRE 1.5 or newer should be listed.
Expand the twisty to find Execution Time Analysis. Check both.
Figure 9. Profile using Java Profiler
If you had set the JVM arguments for J2EE Request Profiler earlier, then the agent J2EE Request Profiler should be listed. Check the agent listed.
Figure 10. Profile using J2EE Request Profiler
- Select the Common and Destination tabs to view additional configuration options, such as specifying the profiling project. You can modify values on these two tabs as needed, but additional configuration is not required for this example.
Switch back to Agents Tab and click Profile.
- Once monitoring begins, you are ready to start profiling the
application. Note the Process ID (PID) of server1 from the
Profiling Monitor tab as shown in Figure
11 and Figure 12.
Figure 11. Execution Time Analysis - Java Profiling
Figure 12. J2EE Request Profiler
Profile the application and analyze views
Once the Profiler has been configured, the application to be profiled can
be accessed via the URL
The profiling data is captured and can be analyzed in Rational Application
Java Profiler views. To open a new view, right-click <monitoring....collecting> Profiling (date) > Open With. You have several options to choose from:
- Execution Time Analysis
- Memory Statistics
- Thread Statistics
Figure 13. Java profiler view
Execution statistics for a sample application are shown in Figure 14.
Figure 14. Sample execution statistics
J2EE Request Profiler views. To open a new view, right-click <monitoring....collecting> J2EE Request Profiler (date) - > Open With. You have several options to choose from--for example, UML2 Object Interactions, UML2 Class Interactions, and UML2 Thread Interactions
To display the captured data in the Profiling Perspective, right-click in the Profiling Monitor view and select Refresh Views. This updates the data for all views. Once the data has been displayed, the view must be refreshed again in order to display newly captured data.
Figure 15. J2EE Request Profiler
Memory statistics of a sample application are shown in Figure 16.
Figure 16. Sample memory statistics
More information on each of these views is found in the appropriate modes below. The four levels are:
You can switch between the package, class, method, and instance modes by selecting the appropriate toolbar control.
- "WebSphere Application Server V8 Information Center" contains additional information on application profiling.
- See Rational Application Developer V7.5 Information Center for more discussion of profiling using Rational Application Developer.
- Chapter 27 of the Redbook Rational Rational Application Developer V7.5 Programming Guide provides an example of profiling.
Dig deeper into WebSphere on developerWorks
Get samples, articles, product docs, and community resources to help build, deploy, and manage your cloud apps.
Keep up with the best and latest technical info to help you tackle your development challenges.
Software development in the cloud. Register today to create a project.
Evaluate IBM software and solutions, and transform challenges into opportunities.