hazelcast / hazelcast-hibernate

A distributed second-level cache for Hibernate
Other
44 stars 35 forks source link

LocalCacheRegion does not collect any statistics #157

Closed u6f6o closed 3 years ago

u6f6o commented 8 years ago

We use hazelcast as a second level cache for hibernate in p2p mode using a HazelcastLocalCacheRegionFactory, thus synchronising updates in the cache via invalidation messages.

Shortly before we went live, I provided my own modified version because at that time it was lacking LFU eviction mechanics. Aside from that I also added statistics for hits, misses, invalidations, evictions etc.

The current version provides standard eviction mechanisms now (LFU, LRU) but lacks the possibility to gather statistics about the cache regions.

Having (maybe toggable) statistics in there would greatly help to find out if the cache region performs well. In comparison, the ClientNearCache at least collects basic information like hits and misses but the LocalRegionCache has none at all.

I'd really like to have useful stats for the LocalRegionCache as well. I'd also offer to add this functionality and create a github pull request. What do you guys think?

u6f6o commented 8 years ago

It would be furthermore nice to have an integration with dropwizards metircs as well. There is a moduel metrics-ehcache but no metrics-hazelcast so far. I think that needs to be changed.

kobalski commented 8 years ago

@u6f6o Thanks for your feedback. We use hibernate's own SecondLevelCacheStatistics in our integration tests. They provide simple statistics. If you can provide additional functionality, we are always open to contribution and PR requests.

u6f6o commented 8 years ago

@kobalski Thx for the feedback. I think I'll put some effort in because we need something like that for our application. As soon as a PR is ready, I'll get back to you.

emre-aydin commented 7 years ago

@u6f6o any updates on the PR?

jontejj commented 7 years ago

We would also like this one. I'm open to implementing it if @u6f6o won't answer soon!

pivovarit commented 3 years ago

I double-checked and it looks like the statistics support for local caches is there. Therefore, closing.

com.hazelcast.hibernate.HazelcastLocalCacheRegionFactory

Statistics[ ... second level cache puts=200, second level cache hits=0, second level cache misses=100, entities loaded=100, entities updated=0, entities inserted=100, ...]