Reputation: 239
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!
Upvotes: 0
Views: 503
Reputation: 26713
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.
Upvotes: 1