findEvictionCandidate efficiency?

  • Hi,

    I'm investigating big performance problems in my Hibernate + EHCache webapp. What happens is that after several runs of my benchmark scenario, the webapp becomes very slow and the number of requests per second drops dramatically.

    When I monitor the application with Yourkit, I see that there is a very high contention in Hibernate ReadWriteCache. In fact, I've got a full dump where all threads are blocked in ReadWriteCache (put, lock or other methods) and the only running thread is in

    http-  CPU time: 0:06
    sun.misc.Unsafe.getObjectVolatile(Object, long)
    net.sf.ehcache.Cache.put(Element, boolean)
    net.sf.ehcache.hibernate.EhCache.put(Object, Object)
    net.sf.ehcache.hibernate.EhCache.update(Object, Object)
    org.hibernate.cache.ReadWriteCache.afterInsert(Object, Object, Object)

    In EHCache source code, I see that there is a special algorithm for cache with more than 100 entries, which is my case (200000 entries, no disk store).

    Is it possible that this algorithm is slow in some cases?