Details
Description
Description
In the org.castor.cache.* cache implementations Hashtable and synchronized HashMap will be used as underlying data structures.
Reason for change
Hashtable is a synchronized hash table implementation similarly to a HashMap, where all accesses will be synchronized.
Synchronization means locking and access serialization and thus, performance bottleneck.
Proposal
Replace the two hash table implementations by ConcurrentHashMap, which is part of Java since 1.5.
Benefits
ConcurrentHashMap allows for concurrent access by not locking the whole data structure, but only the so called buckets, which hold part of the data.
Compared to Hashtable in terms of scalability: ConcurrentHashMap provides linear scalability, while Hashtable provides exponential scalability.
Drawbacks
By simply introducing ConcurrentHashMap doesn't mean that all synchronizations can be eliminated, but rather that their usage can significantly be reduced. In order to allow for this thorough analysis and load tests are required.
Additional
This is a container issue for all concrete tasks required to improve the cache implementations.
References: