I have a Java application that uses the Hibernate persistance library, with about 100 mapped classes. To try out second-level caching, I added @Cacheable to 5 of the mapped classes. This caused a standard computation task to take double the time it used to take earlier, although there were several hits on the cached items (as evidenced on the Couchbase cache monitoring console). I can't get the exact average hit ratio due to the transient nature of Couchbase stats, but I estimate it at just about 10-20%.
Does enabling caching for some entities affect the access times for other entities not marked as @Cacheable, causing this performance drop? Or is it caused merely by the added latency of cache querying coupled with a low hit ratio on the cached items?
I'm using Hibernate 3.3. I've disable query caching. I got similar results with Memcached & GemFire as the cache providers.