Search code examples
javacachingehcachedistributed-caching

Cache implementation


I've been researching this for a week now, but I'd like some thoughts on my particular situation...

2 physical servers:

  • Server A - public WAR, admin WAR

  • Server B - public WAR

Requirements:

  • Both WARs need to view the same data.

  • admin WAR modifies / adds data to the cache.

  • public WARs modify other parts of the cache / add data to it.

  • entire cache needs to reside in memory on each physical server (if I add something on Server A admin WAR or public WAR, it needs to show up on Server B public WAR) so in the event of a failure, we aren't waiting for half the cache to be populated

  • 1,500 active users/server, vast majority of traffic is read, very little write

Additional hardware is out of the question.

Is there a good third party caching solution for this scenario? It seems most distributed caching systems want to leave half the data on Server A and half on Server B, which wouldn't meet our failover performance needs.

Thanks for any ideas!


Solution

  • Take a look at the replicated options for EhCache.

    Sounds like you've been searching for information on "distributed caches", which has a different defintion than "replicated cache". A distributed cache is a larger cache system spread out among many machines, so that the loss of anyone machine in the cluster does not bring down the entire cache, but just a portion. In this scenario the total size of your cache can reach (number of machines times memory of each machine).

    In a replicated cache, the cached data is replicated across each machine, limiting you to a total cache size of max(memory of any one machine).