javahibernatecachingdistributed-caching

hibernate distributed 2nd level cache options


Not really a question but I'm looking for comments/suggestions from anyone who has experiences using one or more of the following:

A bit of background: our applications is read only for the most part but there is some user data that is read-write and some that is only written (and can also be reasonably inaccurate). In addition, it would be nice to have tools that enable us to flush and fill the cache at intervals or by admin intervention.

Regarding the first option - are there any concerns about the overhead of RMI and performance of Java serialization?


Solution

  • I'm working with EhCache for Hibernate and for application level cache since 3 years ago. We use it with RMI for cache invalidation and it works really good. If you use the cache for replication you should take care about the object graph, it could turn very heavy with high cardinality relations.

    If you use EhCache for Hibernate you could use it for Query cache (it's a good improvement for read-only tables) and it the table is modified it cleans the cache automatically. Using EhCache to cache collections is a good idea too, to avoid joins a sub-selects.

    To clean the caches at time intervals you could implement a cache extension of EhCache that cleans the caches. We did it, it works well.