First my setup, L2 cache: Coherence 3.7 Nodes in cluster: 2 Within coherence config files , cluster name for the same and the caching service is also the same. Actually the config files are the same. Both nodes running on the same machine. Within hibernate.cfg.xml <property name="cache.use_second_level_cache">true</property> <property name="cache.provider_class">com.tangosol.coherence.hibernate.CoherenceCacheProvider</property> <property name="hibernate.cache.region_prefix"></property> <!-- Disable the query cache --> <property name="cache.use_query_cache">false</property> <property name="hibernate.show_sql">false</property> <!-- statistics --> <property name="generate_statistics">true</property>
The sequence of the running the apps is as follows Node1: Begin Node2: Begin and perform transactions that should be cached Node2: Stop Node2: Begin and perform the same transactions Node2: Stop Node1: Show stats
The stats are as follows for most of the regions SecondLevelCacheStatistics[hitCount=0,missCount=0,putCount=0,elementCountInMemory=22,elementCountOnDisk=-1,sizeInMemory=-1]
And the logs during the second run, clearly show the hits, misses and puts, but these are not reflected in the stats. [2011-08-12T12:22:20.424+05:30] [hibernate] [TRACE:32] [] [org.hibernate.cache.ReadWriteCache] [tid: main] [ecid: 0000J6wkkgy1ZbOLMip2ie1EHCqK000000,0] [SRC_CLASS: org.hibernate.cache.ReadWriteCache] [SRC_METHOD: get] Cache lookup: [2011-08-12T12:22:20.424+05:30] [hibernate] [TRACE:32] [] [org.hibernate.cache.ReadWriteCache] [tid: main] [ecid: 0000J6wkkgy1ZbOLMip2ie1EHCqK000000,0] [SRC_CLASS: org.hibernate.cache.ReadWriteCache] [SRC_METHOD: get] Cache miss: [2011-08-12T12:22:20.427+05:30] [hibernate] [TRACE:32] [] [org.hibernate.cache.ReadWriteCache] [tid: main] [ecid: 0000J6wkkgy1ZbOLMip2ie1EHCqK000000,0] [SRC_CLASS: org.hibernate.cache.ReadWriteCache] [SRC_METHOD: put] Caching: [2011-08-12T12:22:20.496+05:30] [hibernate] [TRACE:32] [] [org.hibernate.cache.ReadWriteCache] [tid: main] [ecid: 0000J6wkkgy1ZbOLMip2ie1EHCqK000000,0] [SRC_CLASS: org.hibernate.cache.ReadWriteCache] [SRC_METHOD: get] Cache lookup: [2011-08-12T12:22:20.497+05:30] [hibernate] [TRACE:32] [] [org.hibernate.cache.ReadWriteCache] [tid: main] [ecid: 0000J6wkkgy1ZbOLMip2ie1EHCqK000000,0] [SRC_CLASS: org.hibernate.cache.ReadWriteCache] [SRC_METHOD: get] Cache hit:
Most of the forums ask the dev to switch on the generate_stats flag in hibernate. I've done that. What else am I missing
|