0

I'm working caching sql results for my distributed application servers. I found ehcache and memcached are 2 popular options for hibernate L2 cache. It seems that ehcache is much faster than memcached, and it has much easier operational advantage(ehcache is well supported to integrate to hibernate).

However, my concern is how to set up ehcache for a cluster of app servers and sync them? It seems ehcache cluster support is not open source and very very expensive. Is there a way to use its cluster app server support without any payment? Here's its config doc: http://ehcache.org/documentation/configuration/distributed-cache-configuration

The same concern comes to hibernate query cache.

Anybody has any experience?

Thanks a lot!

1 Answer 1

1

Ehcache offers free clusterization, see documentation related to replicated caching.

Or you can implement the replication yourself (I've done it successfully, implementation is being used in live enterprise systems). What you need is implementing CacheEventListener and/or CacheEventListenerFactory and listening to cache flush events on a local node. If an entry gets flushed, updated or removed, you need to propagate this to the other nodes so they don't serve stale data.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.