Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

EhCache order of magnitude slower than CHM?

2012-12-10
2013-05-14
  • Hi all,

    I'm testing the performances of EhCache and I'm surprised to find that it seems 1 order of magnitude slower than a ConcurrentHashMap when used as a local, in-memory cache with no transaction.
    I ran the test using the RadarGun framework (https://github.com/radargun/radargun). The characteristics are:
    - 1 thread only
    - 50K keys, 500K operations (30% puts)
    - JVM size 1GB (-Xmx == -Xms == 1024M)
    - object size: 3K
    - basic configuration : 1000000 max entries in cache, alternate config: 30K entries max + eviction on disk

    I pasted at the end of this message the obtained data (raw CSV data).

    Surprisingly, the in-memory version of ehcache is almost 6 times slower than a concurrent hash map. I was expecting much closer performances for basic caching with no transaction, no eviction, no distribution. I used custom keys, but we are using them a lot and the distribution of the hash seems OK.

    Do you have an idea what could explain slow performances like this?

    Thanks,
    Vincent

    PRODUCT;REQ_PER_SEC;avgreq(ms);READS_PER_SEC;avgread(ms);WRITES_PER_SEC;avgwrite(ms)
    HashMap;4850103.11;2.06E-04;5025060.01;1.99E-04;4485115.63;2.23E-04
    ConcurrentHashMap;2946965.36;3.39E-04;3665389.59;2.73E-04;2019357.16;4.95E-04
    ehcache26(memory);820099.18;1.22E-03;974746.86;1.03E-03;598695.50;1.67E-03
    ehcache25(memory);811417.41;1.23E-03;968350.49;1.03E-03;589000.51;1.70E-03
    ehcache26(disk);19967.92;0.050;28753.73;0.035;11660.61;0.086
    ehcache25(disk);19666.73;0.051;28064.28;0.036;11583.81;0.086