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

Improve Metaspace reporting



    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 11
    • Fix Version/s: 11
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:



        Metaspace reporting and the underlying coding can be improved in a number of ways:

        - The number of times we have to walk the CLDG or other metaspace structures can be reduced. The existing code walks the data structures often to retrieve single values. That is often inefficient, it would be better to collect all values in a single walk.

        - There are a lot of redundant reporting code which produces identical or similar output.

        - The jcmd VM.metaspace command can be made much more useful than it is now, by showing more details about class loaders, metaspace types etc.


        Update: the final form of this patch greatly extends the capabilities of the "VM.metaspace" diagnostic command:

        Prints the statistics for the metaspace
        Options: (options must be specified using the <key> or <key>=<value> syntax)
                basic : [optional] Prints a basic summary (does not need a safepoint). (BOOLEAN, false)
                show-loaders : [optional] Shows usage by class loader. (BOOLEAN, false)
                by-chunktype : [optional] Break down numbers by chunk type. (BOOLEAN, false)
                by-spacetype : [optional] Break down numbers by loader type. (BOOLEAN, false)
                vslist : [optional] Shows details about the underlying virtual space. (BOOLEAN, false)
                vsmap : [optional] Shows chunk composition of the underlying virtual spaces (BOOLEAN, false)
                scale : [optional] Memory usage in which to scale. Valid values are: 1, KB, MB or GB (fixed scale) or "dynamic" for a dynamically choosen scale. (STRING, dynamic)

        - a new sub option "by-chunktype" allows to optionally get statistics by metaspace chunk type.
        - a new sub option "by-spacetype" allows to optionally get statistics by metaspace space type. This allows for easier accounting of metaspace usage to e.g. reflection, anonymous classes etc
        - a new sub option "show-loaders" was added to optionally print metaspace consumption by loader.
        - a new sub option "vslist" was added to print out details about the underlying virtual space mapping lists
        - a new sub option "vsmap" was added to print out an ascii map detailing the chunk composition of the various space nodes.
        - a new sub option "basic" was added to print out basic details of metaspace consumption which can be collected without safepoint and without drawing a lock. That report can be used in places where a "normal" metaspace report is considered too dangerous (a normal report walks the CLDG and draws metaspace locks). For example, as part of logging in case of a Metaspace OOM, or as part of the hs-err log file.

        In addition to these new options, the following improvements and corrections were added:
        - a new output section was added, "Metaspace Waste", which tries to detail typical metaspace waste scenarios. That makes it easier for support to quickly pinpoint typical pathological cases.
        - a new section was added to print chunk freelists.
        - the existing sub option "scale" was extended by a value "0" which means "dynamic scaling". That means, the most fitting scale is choosen by the report (e.g "KB" for values smaller than 1MB).
        - printout was made clearer in the face of rounding errors
        - printout contains percentages.


            Issue Links



                stuefe Thomas Stuefe
                stuefe Thomas Stuefe
                0 Vote for this issue
                2 Start watching this issue