OpenJDK 64-Bit Server VM Zulu11.31+11-CA (build 11.0.3+7-LTS, mixed mode)
Any JDK 11 should work.
Ensure jcmd tool
This procedure uses the jcmd command line tool. This tool is shipped with JDK devel packages. Please ensure the appropriate JDK devel package is installed on the CM Server host. For example, if using the java-11-openjdk package, ensure that java-11-openjdk-devel is installed. The jcmd tool is located in the same directory as the java executable. Ensure that the jcmd tool matches the java command used to run the CM Server.
When using Oracle JDK, it may be necessary to add the following flag to the Java command line of CM server.
Check the Oracle JDK docs for Java Flight Recorder to see if this is necessary.
Edit the file /etc/default/cloudera-scm-server and add the flag to the CMF_JAVA_OPTS line near the end of the file.
This section is informational only, and can be skipped.
# /usr/java/default/bin/jcmd 17444 help
The following commands are available:
. . .
. . .
For more information about a specific command use 'help <command>'.
# /usr/java/default/bin/jcmd 17444 help JFR.start
. . .
Possible settings are found here:
# ls /usr/java/default/lib/jfr/
Capturing performance profile
To start a performance capture for 10 minutes. [Substitute the correct PID for the running CM server process].
# /usr/java/default/bin/jcmd 17444 JFR.configure stackdepth=128
Stack depth: 128
# /usr/java/default/bin/jcmd 17444 JFR.start name=cm-capture \ settings=profile duration=10m disk=true filename=/tmp/cm-profile.jfr path-to-gc-roots=true
Started recording 2. The result will be written to:
Now perform whatever actions on Cloudera Manager that need to be profiled. If the actions to be recorded take longer than 10 minutes, increase the “10m” duration value in the command above as needed.
NOTE: It will take about 15 minutes for the JVM to finalize the performance capture after the capture duration. So if capture duration is 10 minutes, then it may take 10 + 15 = 25 minutes for the capture file to be written out. During this time the capture file size will remain zero (0).
This process will create a performance capture file called cm-profile.jfr in /tmp directory. A 10 minute capture could be 20MB to 40MB in size.
Recommend compressing the file using gzip.
# gzip /tmp/cm-profile.jfr
Upload the compressed file to Cloudera case ticket for analysis.
When the capture is completed, the result will be:
# /usr/java/default/bin/jcmd 17444 JFR.check
No available recordings.
Could not start recording, not able to write to file /root/cm-profile.jfr
Solution: Target directory needs to be writable by cloudera-scm user (CM server running as that user). Either change permissions/owner on the target directory, or use a different path for the capture file.
Problem 2: jcmd tool not able to communicate with CM server JVM.
Solution 2: The jcmd tool does not have permissions to communicate with CM Server JVM running as cloudera-scm user. Add the prefix “sudo -u cloudera-scm” user to the jcmd line above to switch to the correct user.