| Thank you Sanne Grinovero for your comment but The memory usage is growing beyond control bringing server to it's knees. Let me explain how I am using query cache and you can correct me if i am doing something wrong.
'hibernate-entitymanager': 'org.hibernate:hibernate-entitymanager:5.1.2.Final',
'hibernate-core' : 'org.hibernate:hibernate-core:5.1.2.Final',
'hibernate-ehcache' : 'org.hibernate:hibernate-ehcache:5.1.2.Final',
'ehcache' : 'net.sf.ehcache:ehcache:2.9.1',
Default ehcache configuration.
<defaultCache
timeToLiveSeconds="1"
maxElementsInMemory = "1"
overflowToDisk="false"
/>
<property name="hibernate.cache.use_second_level_cache" value="true"/>
<property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory"/>
<
I realized today that we are technically not even using Query cache because of the above configuration but still that should not lead to memory leak but we are expiring query plans more often. We are using JPA and do not interact with hibernate directly. I looked for left out references of EntityManager etc i do not find them on heap.
|