How to monitor a BusinessWorks Appnode memory and threads usage using JMX and JvisualVM
During performance or volume tests, or while working in the analysis of a complex issue, it is sometimes useful to view what is going on within an Appnode JVM to be able to identify bottlenecks and improve the Appnode or the BusinessWorks applications runtime configuration.
This is also useful to compare the behavior of different Garbage Collectors or to evaluate different Garbage Collector configurations.
This article is to explain how to monitor a BusinessWorks Appnode using JMX and the open source solution JVisualVM.
Configure the appnode to enable JMX
This can be done with the following:
. Go to the target appnode ‘bin’ directory, this is in the following form:
<TIBCO_HOME>/bw/6.X/domain/<DOMAIN_NAME>/appnodes/<APPSPACE_NAME>/<APPNODE_NAME>/bin
. Edit the .tra file of the appnode
. At the end of the file add the following lines
java.property.com.sun.management.jmxremote=true
java.property.com.sun.management.jmxremote.port=9614
java.property.com.sun.management.jmxremote.local.only=false
java.property.com.sun.management.jmxremote.authenticate=false
java.property.com.sun.management.jmxremote.ssl=false
. Restart the appnode
Note : if you need to monitor multiple appnodes you have to use a unique port number of each appnode
Install JVIsualVM
JVisualVM is an open source solution, it can be downloaded at the following URL:
https://visualvm.github.io/download.html
To install it you just have to unzip the downloaded package in the directory of your choice.
JVisualVM needs a Java JDK 8 at minimum to run, if you don’t have a Java JDK 8 available in your environment you have install one (you can use OpenJDK 8 for example).
If your JDK installation is included in your environment path you can use JVisualVM directly otherwise you have to update the default JVisualVM configuration:
. Go in the JVisualVM configuration directory <JVISUALVM_HOME>/etc
. Edit the file jvisualvm.conf
. Uncomment the following line and add the path to your JDK
change
#visualvm_jdkhome=”/path/to/jdk”
to
visualvm_jdkhome=c:\tools\OJDK8
Monitor the appnode with JVisualVM
Once JVisualVM is launched use the “File -> Open JMX connection” menu option, the following dialog open:
Enter your target appnode hostname and JMX port and click OK:
The target appnode now appears in the application tab:
Right click on it and select ‘Connect’, then right click again and select ‘Open’, the Overview tab is showing up:
You can select the Monitor tab to monitor the CPU usage, Heap size and usage, and Classes and threads related statistics:
You can select the Threads tab to view Threads that are used by the Appnode:
Finally you can use the ‘Heap Dump’ button to generate a ‘Heap Dump’ for further analysis:
Additional elements for a memory leak analysis
In the context of a memory leak analysis you can the use Eclipse Memory Analyser to check a Thread Dump generated by JVisualVM.
This tool, from the Eclipse Fundation, can be downloaded at the following URL:
https://projects.eclipse.org/projects/tools.mat/downloads
Additional elements for BusinessWorks 5.X
The same approach can be used with a BusinessWorks 5.X engine.
You just have to update the .tra file of the target application to add the properties mentioned above.
The .tra file of an application is located in the following directory:
<DOMAIN_HOME>/application/<APPLICATION_NAME>