views:

564

answers:

1

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.

+2  A: 

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.

Toader Mihai Claudiu
Yep, thats definitely the next step for us. I was seeing whether others have had previous experience of performance issues due to hydration before.
Il-Bhima