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

Speed up CDS dump time by using resizable hashtables

    XMLWordPrintable

Details

    • b21
    • Verified

    Description

      CDS dumping uses ResourceHashtable, for example, to store the relocated address of every archived MetaspaceObj. See

      http://hg.openjdk.java.net/jdk/jdk/file/f1bb77833b59/src/hotspot/share/memory/metaspaceShared.cpp#l1087

        typedef ResourceHashtable<
            address, address,
            ArchiveCompactor::my_hash,
            ArchiveCompactor::my_equals,
            16384, ResourceObj::C_HEAP> RelocationTable;

      However, the template class ResourceHashtable requires the size to be statically specified in the source code. Currently we pick the size 16384 because it's not too big and it is sufficient for up to a few thousand classes.

      However, if we dump all the classes in the system modules (about 35000 classes), the RelocationTable would need to store about 2,000,000 records, making each bucket over 100 entries. This causes drastic slow down with CDS dumping.

      Test case -- LotsOfClasses.classlist is in attachment

       java \
          -XX:MaxRAM=8g -Xshare:dump \
          -Xlog:cds,cds+hashtables -Xlog:hashtables \
          -XX:SharedArchiveFile=LotsOfClasses.jsa \
          -XX:ExtraSharedClassListFile=LotsOfClasses.classlist \
          --add-modules ALL-SYSTEM

      -----

      First draft: http://cr.openjdk.java.net/~iklam/jdk12/8213587-configurable-resource-hash.v01/

      BEFORE: 93.971 sec
      AFTER: 34.761 sec

      Attachments

        Issue Links

          Activity

            People

              iklam Ioi Lam
              iklam Ioi Lam
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: