How to profile and debug JBoss application server when either more information is needed beyond the maximum level of debugging available to us, or when JBoss stops writing to the log. This is very good also for finding memory leaks down to the method level.
When troubleshooting issues with IM and JBoss, we are most commonly relying on various debugging levels of the application components and/or the application server components. However there can be hangs, memory leaks and performance issues in the application server that will not be logged. At times the application server may just stop writing to the log file altogether, leaving us at a dead end with troubleshooting.
To that end there is a free profiling tool from Eclipse that does not require installation. It monitors various aspects of the java process - e.g. memory usage (to check for any leaks), execution time etc, and it does so by tracing every single method in every class in every package. It is particularly simple to view from the interface itself because there you can refer specifically to the package causing the problem - is it a IM package, a core application server package etc. This is highly important for differentiating between a product problem and a JBoss core problem, and proving this differentiation.
This tool is called Eclipse TPTP (Test and Performance Tools Platform), and it can be downloaded from this location: http://www.eclipse.org/tptp/home/downloads/
Please follow these instructions to get it working:
- Copy and unzip it to a machine with JBoss
- Ensure the piAgent.dll library used by the profiler is in your path
(found under tptp.runtime.allInOne.win32.win32.x86-TPTP-4.7.2\eclipse\plugins\org.eclipse.tptp.platform.ac.win_ia32_4.4.302.v201102041430\agent_controller\bin)
- Configure the agentController (tptp.runtime.allInOne.win32.win32.x86-TPTP-4.7.2\eclipse\plugins\org.eclipse.tptp.platform.ac.win_ia32_4.4.302.v201102041430\agent_controller\bin)
- Start the AgentController (tptp.runtime.allInOne.win32.win32.x86-TPTP-4.7.2\eclipse\plugins\org.eclipse.tptp.platform.ac.win_ia32_4.4.302.v201102041430\agent_controller\bin\acserver.exe)
- Add the -XrunpiAgent:server=enabled JVM parameter onto the java command used to start JBoss:
set JAVA_OPTS=-Djava.security.policy=.\workpoint_client.policy -Xms256m -Xmx1024m -XX:MaxPermSize=256m -XX:ReservedCodeCacheSize=50m -XrunpiAgent:server=enabled %JAVA_OPTS%
- Restart JBoss
- In Eclipse: Select menu Window ? Open Perspective ? Other ? Profiling and Logging. Run ? Profile Configurations.
- Select Attach To Agent then click the 'New' button. Select the default host (localhost:10002), pickup the java profiling agent, apply changes.
- Click 'Profile' and the profiler starts collecting statistical data related to memory usage and execution times, per object, per function.