Il-Bhima
Il-Bhima

Reputation: 10880

Performance of hibernate Second Level Caching ehcache

We are considering using ehcache (1.6.0-beta5) to enable second level caching of a number of tables which are never modified. We have set up a read-only ehcache region for this table and currently it seems to be working fine. The Hibnerate POJOs stored in the cache are all immutable.

One of the developers here raised an issue that there is a significant performance decrease in the time taken to 'hydrate' objects from the ehcache, that is, the mapping from ehcache's internal representation of an entity to an actual java object. Instead he suggested we store objects manually in a cache of our own. This would require significant modification of our code and I have reservations on how big the improvement would be.

My questions are:

  1. Is this decrease in performance really significant?
  2. If the entities are immutable in a read-only cache, would ehcache actually need to do any hydration at all? Couldn't it just store the objects directly?

Thanks for any help.

Upvotes: 6

Views: 2182

Answers (1)

Mihai Toader
Mihai Toader

Reputation: 12243

You should profile the time it takes for hydration. And if that is significat (at least a couple of percents) you should think about changing code.

Upvotes: 4

Related Questions