Attaching to a Remote Application

See Also

You can profile an application that is running on a remote system by attaching the profiling tool to the application. When you use this attach mode, the remote application starts after the profiler is attached. This mode enables you to obtain profiling data on the startup of the target JVM.

To attach the profiling tool you use the Attach Settings dialog box to specify the attachment settings for your project. In the Attach Settings dialog box you specify the location, OS and JVM of the remote target. Based on the details that you provide, the Attach Settings dialog box provides you with a set of instructions on how to configure the remote application to support profiling.

To attach the profiler to a remote application you need to configure the application to load some profiler libraries on startup to enable the profiling tool to attach to the application. You use the Attach Settings dialog box to specify the details of the remote system and to generate a Remote Profiler Pack archive that contains the necessary profiler libraries. You need to copy the contents of the Remote Profiler Pack archive to the remote system and then configure the remote application to load the profiler libraries.

After you configure the remote application according to the instructions, you can start the remote application and attach the profiler. You only need to configure the attach mode once. The attachment settings are associated with that project. You can open the Attach Settings dialog box at any time to change the attachment settings.

Perform the following steps to profile a remote application.

  1. Choose Profile > Attach Profiler from the main menu.
  2. Select the Project from the dropdown list at the top of the Attach Profiler dialog box, if available.
  3. At the bottom of the dialog box, click define to open the Attach Settings dialog box.
  4. In the Attach Settings dialog box, select Remote as the Target option.
  5. Specify the Hostname and select the OS and JVM from the dropdown list.
  6. Save the Remote Profiler Pack to your local system and then copy the contents to the remote system.
  7. Copy the profiler agent parameters in the text box of the Attach Settings dialog box and add the parameters to the startup script of the remote application.
  8. Click OK in the Attach Settings dialog box.
  9. Start the remote application.

    When you start the remote application, the application will wait until the IDE is attached before starting.

  10. Select a profiling task and any profiling options.
  11. Click Attach in the Attach Profiler dialog box.

When you click Attach, the IDE will attach to the remote JVM and the remote application will start. You can view profiling data as you would for a local application.

After the IDE is attached to the remote application you can do the following:

Attaching to a Remote Server

Similar to attaching the profiler to a remote application, you need to copy the profiler libraries in the Remote Profiler Pack to the remote system to attach the profiling tool to a remote server. You also need to modify the server configuration files to specify the path to the JDK and to specify the path to the profiler agent. When you start the server using the modified startup script, the server will wait until the profiler attaches to the server.

You can retrieve the path to the profiler agent when you use the Attach Settings dialog box to configure your attach settings. The path to the profiler agent will be similar to the following path.
-agentpath:<remote>\lib\deployed\jdk16\windows\profilerinterface.dll=<remote>\lib,5140
The placeholder <remote> refers to the full path to the root directory containing the profiler libraries that you copied to the remote system. The number 5140 is the Communication Port that the profiling tool uses to connect to the application. You can modify the port number in the Profiler tab in the Java category in the Options window.

The following table identifies the startup scripts and the parameters that need to be modified to specify the paths to the JDK and the profiler libraries.

Server File Modification
Tomcat 7 catalina.bat/catalina.sh set JAVA_HOME to path to JDK for server
modify CATALINA_OPTS to include profiler -agentpath parameter
GlassFish 3 asenv.bat/asenv.conf
domain.xml
set AS_JAVA to path to JDK for server
add <jvm-options> elements to include profiler -agentpath parameter
WebLogic 12 startWebLogic.cmd/startWebLogic.sh set JAVA_HOME to path to JDK for server
modify JAVA_OPTIONS to include profiler -agentpath parameter
JBoss 7 standalone.conf.bat/standalone.conf set JAVA_HOME to path to JDK for server
modify JAVA_OPTS to include profiler -agentpath parameter

Notes.

See Also
Profiling Using Attach Mode
Attaching to a Local Application
Selecting a Profiling Task

Legal Notices