I am wondering what is the best way to configure multiple clusters of invalidation caches in the same network to prevent excessive network traffic, are the defaults with UDP discovery enough? Are invalidation messages sent to all the caches regardless of their name?
I am currently using infinispan to create invalidation caches for my app. This is my current setup (Nothing strange, just a couple of tomcat servers under a Load Balancing setup)
Each one of the Tomcat instance has several contexts (one per customer). Inside each app, I'm creating a default cache manager as follows:
GlobalConfiguration globalConfiguration = new GlobalConfigurationBuilder() .transport() .defaultTransport() .addProperty("configurationFile", "default-configs/default-jgroups-udp.xml") .globalJmxStatistics() .allowDuplicateDomains(true) .build(); org.infinispan.configuration.cache.Configuration defaultCacheConfiguration = new ConfigurationBuilder() .clustering() .cacheMode(CacheMode.INVALIDATION_ASYNC) .async() .build(); cacheManager = new DefaultCacheManager(globalConfiguration, defaultCacheConfiguration);
And when creating a cache I use cacheManager.getCache(clientName+"/"+groupKey).
What I want to do is making sure an invalidation message for a given cache, say "clientA/users", is not sent to "clientB/users". I have verified that right now the entries are not invalidated so the context of each client is kept correctly, but I'm concerned that given that all clients are in the same network, there may be unnecessary traffic going on.
Is using the default jgroups.xml adequate in this case? or should I look forward to somehow create individual "groups" per client?