Details
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
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
- is blocked by
-
JDK-8213574 Deadlock in string table expansion when dumping lots of CDS classes
- Closed
- relates to
-
JDK-8214030 BasicHashtable entry management needs to be cleaned up
- Closed