This knowledge article may contain information that does not apply to version 21.05 or later which runs in a container environment. Please refer to Article Number 000385088 for more information about troubleshooting BMC products in containers.
While troubleshooting stability or performance issues of the Smart IT Application, BMC Support may request a customer to create Java Heap or Thread Dumps of Smart IT’s Tomcat server.
Examples of situations where this information may be requested:
Heap Dump: To analyze OutOfMemory errors in Tomcat logs (e.g. the Heap Memory usage may have a constant increasing trend, eventually leading to all available Heap space being used, resulting in OutOfMemory errors and the Application to stop functioning properly)
Thread Dump: To analyze situations where either specific use cases are performing poorly, or there is a sudden general performance issue for the whole Smart IT Application (and where the performance issue cannot be explained by slowness of services that Smart IT depends on, i.e. AR Server, Smart IT DB, RSSO are found to be responding in a timely manner). In these situations, high CPU usage but stable memory consumption may be observed for the Tomcat process.
The VisualVM application can be used to create such Java Heap and Thread Dumps. The suggestion would be to install this client on a separate (Windows) machine and connect from there to the target Smart IT Tomcat Server. To allow VisualVM to connect to Smart IT’s remote Java Virtual Machine (JVM), some additional parameters need to be configured for Tomcat. Instruction to obtain VisualVM and on how to configure Tomcat are provided below.
Notes:
- There are also command line alternatives to create Thread and/or Heap dumps. AR Platform Knowledge Article 000248856 lists several of those options (in the Smart IT case, you would use the Process ID (PID) of the Tomcat process rather than the AR Server Java PID).
- In case (frequent) crashes of the Smart IT Tomcat Server are observed, the suggestion would be to add the following parameter to Tomcat’s Java/Catalina options:
-XX:+HeapDumpOnOutOfMemoryError
This parameter would assure that an automatic heap dump is created when an OutOfMemoryError error is thrown. The heap dump can then be shared with Customer Support. Knowledge Article
000254961 shows where this parameter should be added.
VisualVM client installation
Option 1: The VisualVM tool comes bundled with Oracle Java Development Kit (JDK) 8. On a Windows system with the JDK installed, the VisualVM application can be started by double-clicking on the ‘jvisualvm.exe’ in your JDK bin folder.
Note: Visual VM is no longer bundled with JDK versions after JDK 8.
Option 2: The VisualVM Tool can be downloaded as a standalone tool from the following location:
Preparing Smart IT’s Tomcat server to allow JMX connections
The information below includes the basic setup to enable JMX connections (e.g. without authentication or ssl). While this may be sufficient in a local network where access is restricted, do consider if further security settings for JMX access should be enabled, especially in case the server/port can be accessed from remote locations (see also: Apache Tomcat Security Considerations).
Find a free port on the Smart IT Server (port 9010 is used in the example below).
Smart IT Server on Windows OS
- In Windows Explorer, open Tomcat‘s ‘bin’-folder
- Open the Tomcat monitor application by double clicking its executable – if the Tomcat Service name would ‘SmartITTomcat8’, the executable would name would be ‘SmartITTomcat8w.exe’
- Go to the ‘Java’-tab and add the following lines in the ‘Java Options’ section (note: update the port and IP address as required):
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9010
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname=<ip_address_smt_server>
Click ‘Apply’ and restart Tomcat
- Confirm the configured remote port is available to accept requests – e.g. from the command line, execute:
netstat -an | findstr 9010
Smart IT Server on Linux OS
- Go to Tomcat’s 'bin'-folder
- Create a backup of the setenv.sh file, then edit the file to add the following line (update the port number and IP address as required):
export CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=<ip_address_smt_server>"
- Restart Tomcat
- Confirm the configured remote port is available to accept requests – e.g. from the command line, execute:
netstat -an | grep 9010
Creating Heap and Thread Dumps using VisualVM
- Open the VisualVM application
- Right-click on ‘Remote’ and select ‘Add Remote Host…’
- Enter the Host name of the Smart IT server in the Pop-up and click ‘Ok’
- Right-click on the Remote host that was added and select ‘Add JMX Connection…’
- In the dialog, enter the port number that was configured in Tomcat’s Java properties and press ‘Ok’
- Double click on the new entry under the Remote host name to open the connection
- If a Heap dump is what is requested, go to the ‘Monitor’-tab, click ‘Heap Dump’ and confirm the folder on the remote host (i.e. Smart IT Server) where the Heap Dump (.hprof file) will be saved:
NOTE: Before taking a Heap dump, please confirm that sufficient free disk space is available on the Smart IT Server (as the size of the .hprof file can take up as much disk space as the configured maximum heap space).
- If Thread Dumps are requested that capture a specific (poor performing) use case, or a general sudden performance issue, perform the following steps:
- Enable Smart IT Debug logging (if required, check the steps in point 3 of Knowledge Article 000225149 on how to enable this)
- Open Smart IT in the browser and access the Developer Tools (F12) to capture network traffic (for details on how to set this up, please refer to this document)
- In VisualVM open the ‘Threads’-tab and locate the ‘Thread Dump’ button
- Trigger the use case in the browser and as it starts executing, click on ‘Thread Dump’ in VisualVM:
Repeat the ‘Thread Dump’ step multiple times (suggestion is 5 times, with a 10 second interval) to generate multiple thread dumps. This will help identify trends in the thread utilization.
- When the use case completes, save the F12 Network logs to .har file and from the Smart IT server, ZIP the following log files:
- <tomcat>\logs\localhost_access_log.<date>.txt
- ..\Smart_IT\Logs\smartit.log
Note: Make sure the logs that are provided cover the full time frame of the test. In Debug mode, the smartit.log can fill up quickly – if this causes the full time frame not to be present in the smartit.log itself, check in the ‘YYYY-MM-weekX’ subfolders where back-ups are automatically created.
- The Thread Dumps will show-up under the JMX connection in VisualVM. Right-clicking on the JMX Connection will give the option to save an ‘Application Snapshot’ that includes all Thread Dumps:
- Then Right-click on the newly created Snapshot to save it to disk on client side (.apps format):
- Share the Application Snapshot (.apps) file, .har network file, as well as the indicated logs from the Smart IT server for analysis.
See also: BEST FAQ on Remedy for Smart IT Performance Issues On Prem