Collect GC information for an on-premise Mule Runtime instance.
For this purpose, it is necessary to have JDK installed (not just JRE) in your environment. Run the following command:
jstat -gccause -h 1000 -t <pid> 10s > gc.log
This will dump the output to the gc.log file. In the above command, <pid> stands for Java Process ID of the Mule Runtime instance. For more information about "jstat" command, please check the official documentation here.
With the above command, it is not necessary to restart the Mule Runtime instance.
Note: In the generated logs the timestamp is the number of milliseconds since the JVM has started. Also, the number of GC and the time that it take are cumulative. This is very important to correctly read these logs and analyze the results.
Firstly, identify the GC algorithm used by referring to the article: How to Check What Garbage Collection Algorithm is Used by a Running JVM
The wrapper.conf file under the <MULE HOME>/conf folder has listed the following lines, which are commented out. If there is no JDK installed, the alternative is to uncomment the lines below and restart Mule Runtime. The <n> placeholders should be replaced with a sequence of numbers.
wrapper.java.additional.<n>=-XX:+PrintGCApplicationStoppedTime wrapper.java.additional.<n>=-XX:+PrintGCDetails wrapper.java.additional.<n>=-XX:+PrintGCDateStamps wrapper.java.additional.<n>=-Xloggc:%MULE_HOME%/logs/gc.log wrapper.java.additional.<n>=-XX:+UseGCLogFileRotation wrapper.java.additional.<n>=-XX:NumberOfGCLogFiles=5 wrapper.java.additional.<n>=-XX:GCLogFileSize=10M
Note: To avoid the GC logs being overwritten at startup, it is possible to parameterize the GC log file name. There are two options available for use;
%p - the process id for the JVM
%t - the current timestamp
For example, to use the process id and timestamp in the filename, use a "loggc" entry similar to below;
wrapper.java.additional.<n>=-Xloggc:%MULE_HOME%/logs/gc-%p-%t.log
The parameters mentioned above will fail the deployment when using G1GC algorithm so they must be left commented out and instead use the parameter below to the wrapper.conf file and perform Mule Runtime restart.
The <n> placeholders should be replaced with a sequence of numbers.
wrapper.java.additional.<n>=-Xlog:gc*:file=%MULE_HOME%/logs/gc.log:tags,time,uptime,level:filecount=10,filesize=2M
001115026

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.