JDK-8239290 : Add parallel heap iteration for jmap -histo
  • Type: CSR
  • Component: core-svc
  • Sub-Component: tools
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 16
  • Submitted: 2020-02-18
  • Updated: 2024-04-25
  • Resolved: 2020-07-28
Related Reports
CSR :  
Description
Summary
------
Add a new sub-command option "parallel" to the existing "histo" jmap command line option, which specifies how many threads to use to generate the heap histogram.

Problem
-------
"jmap -histo" inspects the heap serially, which takes a long time when the heap is large. Heap iteration time can be significantly reduced by parallel iteration over the object graph.

Solution
-------
Add a new sub-command option "parallel" to the existing "histo" jmap command line option, which specifies how many threads to use to generate the heap histogram.

Specification
------
Updated specification.

    Usage:
    jmap -clstats <pid>
        to connect to running process and print class loader statistics
    jmap -finalizerinfo <pid>
        to connect to running process and print information on objects awaiting finalization
    jmap -histo[:[<histo-options>]] <pid>
        to connect to running process and print histogram of java object heap
    jmap -dump:<dump-options> <pid>
        to connect to running process and dump java heap
    jmap -? -h --help
        to print this help message

    dump-options:
      live         dump only live objects
      all          dump all objects in the heap (default if one of "live" or "all" is not specified
      format=b     binary format
      file=<file>  dump heap to <file>

    Example: jmap -dump:live,format=b,file=heap.bin <pid>

    histo-options:
      live             count only live objects
      all              count all objects in the heap (default if one of "live" or "all" is not specified)
      file=<file>      dump data to <file>
      parallel=<count> generate histogram using this many parallel threads, default 0
                         0 use system determined number of threads
                         1 use one thread, i.e., disable parallelism
                         n use n threads, n must be positive

    Example: jmap -histo:live,file=/tmp/histo.data,parallel=5 <pid>
Comments
Moving to Approved.
28-07-2020

Hi [~lzang], change the sate of the request to "Finalized" to request the second phase of CSR review; for details see: https://wiki.openjdk.java.net/display/csr/Main I've taken the liberty of advancing the request for you.
23-07-2020

Hi Joe, Is there any more work I could do to make this CSR approved? Thanks!
23-07-2020

I've marked this as targeting 16. The patch is currently under review, see https://mail.openjdk.java.net/pipermail/serviceability-dev/2020-July/032181.html
09-07-2020

Moving to Provisional, *not* Approved. What release is this targeting?
08-07-2020

Hi Simonis, Thanks to point it out, the compactibility issue has been solved by the implementation of parallel heap inspection (under reviewing, thread@https://mail.openjdk.java.net/pipermail/serviceability-dev/2020-July/032181.html). and I will do more compatibility test about it. Thanks!
08-07-2020

Specification-wise this looks good to me. We should only be careful with the a actual implementation to avoid problems as with [JDK-8215622][1] where the addition of a similar option led to an incompatibility with older versions of the serviceability tools like jcmd (see http://mail.openjdk.java.net/pipermail/serviceability-dev/2019-February/thread.html#27240) [1]: https://bugs.openjdk.java.net/browse/JDK-8215622
08-07-2020