Performance Comparison

Performance setup

For the following 9 instance of LRUCachingMap, will the same actions performed.
This will cache the instance of Books (see implementation below), where the key is a String.

Pre setup before any
  • Creation of all Caching Directories needed.
  • The generation of all Book instances.
  • Creation of all LRUCachingMap instances.
  • Creation of all HSQLDB tables and setup there of.

Testing configuration
  • Books generated : "10000"
  • LRUCachingMapConfiguration.CleanupIntervalTime : "5 minutes"
  • LRUCachingMapConfiguration.ExpireTime : "30 seconds"
  • LRUCachingMapConfiguration.ExtendTime : "15 seconds"
  • LRUCachingMapConfiguration.MaxExtendCount : "2"
  • LRUCachingMapConfiguration.MaxSize : "8000", when the last 2000 is added they will replace previous added Books.

Testing

The actual testing for 10000 Books in a CachingMap for 8000, for each instance of LRUCachingMap
  • Some Thread sleeps put in.
  • Get method invoked 1875 times.
  • Put method invoked 10000 times.
  • Remove method invoked 500 times.
  • RemoveAll method invoked 1 time.
  • Reload method invoked 1 time.
The instances is:
NameDescription
MemoryCacheMemoryCache.
FilenameXmlCacheThe Books is persisted as XML using XMLUtils, where the key is the filename.
FilenameSerializedCacheThe Books is persisted as Serialized objects, where the key is the filename.
KeyedXmlCacheThe Books is persisted as XML using XMLUtils, where the key is part of the value.
KeyedSerializedCacheThe Books is persisted as Serialized objects, where the key is part of the value.
IndexedXmlCache [100]The Books is persisted as XML using XMLUtils, where the keys is stored in a seperated file save at every 100 changes (put,remove).
IndexedSerializedCache [100]The Books is persisted as Serialized objects, where the keys is stored in a seperated file save at every 100 changes (put,remove)
IndexedXmlCache [800]The Books is persisted as XML using XMLUtils, where the keys is stored in a seperated file save at every 800 changes (put,remove).
IndexedSerializedCache [800]The Books is persisted as Serialized objects, where the keys is stored in a seperated file save at every 800 changes (put,remove)
JPABookSerializedCacheThe Book is persisted in a HSQLDB database, converted by JPA.
JPAStringSerializedCacheThe Book is persisted in a HSQLDB database, converted by SerializableUtils<Book>.

Result - Total time (without memory caching for persisted instances)

NameGet (ms)Put (ms)Reload (ms)Remove (ms)Cleanup (ms)RemoveAll (ms)Runningtime (ms)
MemoryCache718011414225
FilenameXmlCache53122563381218532681237638913
FilenameSerializedCache13441409611198151854312322631
KeyedXmlCache4608223941166016992300206644932
KeyedSerializedCache11481296955357171781278125168
IndexedXmlCache [100]48762496491118365212237840467
IndexedSerializedCache [100]10921609417089693725328027046
IndexedXmlCache [800]54192979877320723050242144046
IndexedSerializedCache [800]8511515311615811848283922587
JPABookSerializedCache3624868012266615874415072
JPAStringSerializedCache23751243266637391135267

Result - Total time (with memory caching for persisted instances)

NameGet (ms)Put (ms)Reload (ms)Remove (ms)Cleanup (ms)RemoveAll (ms)Runningtime (ms)
MemoryCache240041258
FilenameXmlCache363220298803842194276428767
FilenameSerializedCache580134809423861541333020475
KeyedXmlCache34722273119393772222246739864
KeyedSerializedCache4081377256312641512280324680
IndexedXmlCache [100]336279096945231263254933466
IndexedSerializedCache [100]4211640712214473427273324910
IndexedXmlCache [800]326220198354422425266528929
IndexedSerializedCache [800]4161365610462981675320620477
JPABookSerializedCache340675747011454485312672
JPAStringSerializedCache3354310524225428867548