Java Flight Recorder comprehensive list of VM options for OpenJDK 8 & OpenJDK 11

2.1k views Asked by At

Is there a way to get a comprehensive list of VM options for Java Flight Recorder (JFR). I am particularly interested in OpenJdk 8 & OpenJdk 11

so far I find this list quite usefull https://chriswhocodes.com/hotspot_options_jdk8.html

also

java -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -version

Is there any resource that would provide list of options available for JFR?

1

There are 1 answers

4
Kire Haglin On BEST ANSWER

I think the most comprehensive and up-to-date description of the VM option for JFR can be found in the documentation of jcmd JFR.start and JFR.configure

https://docs.oracle.com/en/java/javase/15/docs/specs/man/jcmd.html

-XX:StartFlightRecording:

  • delay (Optional) Length of time to wait before starting to record (INTEGER followed by 's' for seconds 'm' for minutes or 'h' for hours)

  • disk: (Optional) Flag for also writing the data to disk while recording (BOOLEAN, true)

  • dumponexit: (Optional) Flag for writing the recording to disk when the Java Virtual Machine (JVM) shuts down. If set to 'true' and no value is given for filename, the recording is written to a file in the directory where the process was started. The file name is a system-generated name that contains the process ID, the recording ID and the current time stamp. (For example: hotspot-pid-33507-id-1-2019_12_12_10_41.jfr) (BOOLEAN, false)

  • duration: (Optional) Length of time to record. Note that 0s means forever (INTEGER followed by 's' for seconds 'm' for minutes or 'h' for hours)

  • filename: (Optional) Name of the file to which the flight recording data is written when the recording is stopped. If no filename is given, a filename is generated from the PID and the current date and is placed in the directory where the process was started. The filename may also be a directory in which case, the filename is generated from the PID and the current date in the specified directory. (STRING, no default value)

  • maxage: (Optional) Maximum time to keep the recorded data on disk. This parameter is valid only when the disk parameter is set to true. Note 0s means forever. (INTEGER followed by 's' for seconds 'm' for minutes or 'h' for hours, 0s)

  • maxsize: (Optional) Maximum size of the data to keep on disk in bytes if one of the following suffixes is not used: 'm' or 'M' for megabytes OR 'g' or 'G' for gigabytes. This parameter is valid only when the disk parameter is set to 'true'. The value must not be less than the value for the maxchunksize parameter set with the JFR.configure command. (STRING, 0 (no maximum size))

  • name: (Optional) Name of the recording. If no name is provided, a name is generated. Make note of the generated name that is shown in the response to the command so that you can use it with other commands. (STRING, system-generated default name)

  • path-to-gc-root: (Optional) Flag for saving the path to garbage collection (GC) roots at the end of a recording. The path information is useful for finding memory leaks but collecting it is time consuming. Turn on this flag only when you have an application that you suspect has a memory leak. If the settings parameter is set to 'profile', then the information collected includes the stack trace from where the potential leaking object was allocated. (BOOLEAN, false)

  • settings: (Optional) Name of the settings file that identifies which events to record. To specify more than one file, separate the names with a comma (','). Include the path if the file is not in JAVA-HOME/lib/jfr. The following profiles are included with the JDK in the JAVA-HOME/lib/jfr directory: 'default.jfc': collects a predefined set of information with low overhead, so it has minimal impact on performance and can be used with recordings that run continuously; 'profile.jfc': Provides more data than the 'default.jfc' profile, but with more overhead and impact on performance. Use this configuration for short periods of time when more information is needed. Use 'none' to start a recording without a predefined configuration file. (STRING, JAVA-HOME/lib/jfr/default.jfc)

-XX:FlightRecorderOptions:

Besides repositorypath, memorysize and perhaps stackdepth, I would not change any of the below options. They are legacy or there for JVM support engineers to provide workarounds. Using non-default values will increase the risk of crashes or performance related problem.

  • globalbuffercount: (Optional) Number of global buffers. This option is a legacy option: change the memorysize parameter to alter the number of global buffers. This value cannot be changed once JFR has been initalized. (STRING, default determined by the value for memorysize)

  • globalbuffersize: (Optional) Size of the global buffers, in bytes. This option is a legacy option: change the memorysize parameter to alter the size of the global buffers. This value cannot be changed once JFR has been initalized. (STRING, default determined by the value for memorysize)

  • maxchunksize: (Optional) Maximum size of an individual data chunk in bytes if one of the following suffixes is not used: 'm' or 'M' for megabytes OR 'g' or 'G' for gigabytes. This value cannot be changed once JFR has been initialized. (STRING, 12M)

  • memorysize: (Optional) Overall memory size, in bytes if one of the following suffixes is not used: 'm' or 'M' for megabytes OR 'g' or 'G' for gigabytes. This value cannot be changed once JFR has been initialized. (STRING, 10M)

  • repositorypath: (Optional) Path to the location where recordings are stored until they are written to a permanent file. (STRING, The default location is the temporary directory for the operating system. On Linux operating systems, the temporary directory is /tmp. On Windows, the temporary directory is specified by the TMP environment variable.)

  • stackdepth: (Optional) Stack depth for stack traces. Setting this value greater than the default of 64 may cause a performance degradation. This value cannot be changed once JFR has been initialized. (LONG, 64)

  • thread_buffer_size: (Optional) Local buffer size for each thread in bytes if one of the following suffixes is not used: 'k' or 'K' for kilobytes or 'm' or 'M' for megabytes. Overriding this parameter could reduce performance and is not recommended. This value cannot be changed once JFR has been initialized. (STRING, 8k)

  • samplethreads: (Optional) Flag for activating thread sampling. (BOOLEAN, true)