The SystemDictionary is a collection of Dictionary hash tables: one per ClassLoaderData for a java/lang/ClassLoader object. The SystemDictionary has a find_instance_klass() function that needs to do lookups lock free - for each reference to a class name, there's a lookup and the lookup succeeds most of the time. Adding a lock for lookup has pretty significant performance degradation for at least one benchmark.
Adding to the SystemDictionary takes out a SystemDictionary_lock, and each of these Dictionary hashtables are removed all at once when the ClassLoader is unloaded.
Using the ConcurrentHashTable adds a few words of overhead per ClassLoaderData, but no more than Hashtable::_stats_rate (TableRateStatistics) in the old Hashtable implementation. TableRateStatistics is optional now in ConcurrentHashTable.
Besides unlocked lookups, the advantage of using ConcurrrentHashTable is that the resizing can be done concurrently. Also, we may be able to eventually optimize out the SystemDictionary_lock locking, although this lock controls more than dictionary additions, so maybe not. TBD.
Adding to the SystemDictionary takes out a SystemDictionary_lock, and each of these Dictionary hashtables are removed all at once when the ClassLoader is unloaded.
Using the ConcurrentHashTable adds a few words of overhead per ClassLoaderData, but no more than Hashtable::_stats_rate (TableRateStatistics) in the old Hashtable implementation. TableRateStatistics is optional now in ConcurrentHashTable.
Besides unlocked lookups, the advantage of using ConcurrrentHashTable is that the resizing can be done concurrently. Also, we may be able to eventually optimize out the SystemDictionary_lock locking, although this lock controls more than dictionary additions, so maybe not. TBD.
- relates to
-
JDK-8295029 runtime/cds/appcds/LotsOfClasses.java fail with jfx
-
- Resolved
-