Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8243244

Add option to jcmd to write a gzipped heap dump

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 15
    • hotspot
    • None
    • svc
    • behavioral
    • minimal
    • We only add additional flags.
    • add/remove/modify command line option
    • JDK

      Summary

      Add an option to write a gzip compressed heap dump via the GC.heap_dump diagnostic command.

      Problem

      With ever increasing heap sizes, the creation of heap dumps takes long and uses more space.

      Solution

      Add an option to directly write a gzipped heap dump via the diagnostic command GC.heap_dump. Since the deflate mechanism used in the gzip format is relatively slow, the compression is done in parallel.

      When writing to a slow backing store, compression can lead to faster writing of the heap dump. And in practically all cases a compression rate of about 3 or more should be achieved.

      The diagnostic command can be accessed via the jcmd tool. An example would be:

      jcmd <pid|main class> GC.heap_dump -gz=4 dump.hprof.gz

      This would trigger a gzip compressed heap dump of the specified VM, using a compression level of 4.

      For a discussion of alternative solutions see https://mail.openjdk.java.net/pipermail/serviceability-dev/2020-February/030369.html

      Specification

      Add an integer option called gz to the GC.heap_dump diagnostic command. If it is specified, it will enable the gzip compression of the written heap dump. The supplied value is the compression level. It can range from 1 (fastest) to 9 (slowest, but best compression). The recommended level is 1.

            rschmelter Ralf Schmelter
            rschmelter Ralf Schmelter
            Christoph Langer, Goetz Lindenmaier, Serguei Spitsyn
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: