Forums Register Login

Hibernate when and when not to use the second level cache

+Pie Number of slices to send: Send
Our organization struggled with memory and performance issues pertaining to the 2nd level cache like ehcache, and we ended up removing the 2nd level cache. In your experience, is 2nd level cache worth it, and what are the typical practices employed by medium-sized web applications to mitigate these issues?
1
+Pie Number of slices to send: Send
Well, you can cache in the following places:

1. Internal to an app

2. External to an app - sharable by multiple apps on one host

3. On an external cache server (for example when you're marshalling resources from multiple sources, although a DBMS may also internally cache stuff if many clients want it).

Ehcache is designed for level 2. You could use it with only a single local client app, but that's really only something I'd do if the app internal caching wasn't very good. Otherwise you end up with too many copies of the same data at various levels and that's just wasted storage and extra processing overhead.

In addition to the potential data redundancies, you also run into transactional issues. When you have multiple clients sharing a cache, they'd better all be playing nicely with transactions, or things can end up horribly out of sync.

A modest app might not benefit at all from a second-stage cache. Actually, even a large app might not benefit unless you need external tuning abilities.
+Pie Number of slices to send: Send
Thank you very much. That was informative.
Hey, sticks and stones baby. And maybe a wee mention of my stuff:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 833 times.
Similar Threads
When should Hibernate cache be used?
How does NVP based cache stores an object representing a database row?
Hibernate caching- Which caching to use for performance ?
portlet content caching
Caching Technique in Hibernate
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 15, 2024 23:44:15.