Shared cache between Tomcat web applications

I am looking for a solution for sharing a cache between two tomcat web applications running on different hosts. The cache is used for data synchronization, so the cache must be constantly updated between two tomcat instances. (Sorry, I'm not 100% sure if the correct terminology for this requirement is "consistency" or something more specific, for example, using the ACID property). Another requirement, of course, is that it must quickly access the cache, with approximately the same number of entries in the form of readings. I have access to a shared file system, so this is a consideration.

I looked at something like ehcache, but in order to get a common cache between web applications that I would need to implement on top of the Terracotta environment or using the new ehcache cache server. The first one (Terracotta) seems redundant for this, while the cache web server does not seem to provide the fast performance I want.

Another solution I was looking at was to create something simple on top of a fast keystore such as Redis or memcachedb. Redis is in memory, but can be easily configured as a centralized cache, and memcachedb is a persistent disk-based cache that can work because I have a common file system.

I am looking for suggestions on how to best solve this problem. The solution should be a relatively mature technology, as it will be used in a production environment.

Thanks in advance!

+6
source share
2 answers

I am sure that you do not need a terracotta server or ehcache if you need a distributed cache. Ehcache with one of four replication mechanisms .

However, based on what you wrote, I assume that you are looking for more than just a cache. Memcached / Ehcache - examples of what you might call a caching layer for your application - nothing more.

If you find that you use words such as "guaranteed" "updated" "ACID", you are better off using a built-in database such as Oracle Times Ten / MySQL Cluster / Redis with disk persistent storage.

+4
source

You can use memcached (not memcachedb) for fast and efficient caching. Redis or memcachedb can be excessive if you do not want constant caching. Memcached can be grouped very easily, and you can use the spymemcached java client to access it. Memcacached is very mature and runs on several hundred thousand, if not millions of production servers. It can be controlled by Nagios and Munin systems when they are manufactured.

+3
source

Source: https://habr.com/ru/post/886208/


All Articles