LearnerOP
LearnerOP

Reputation: 384

To understand Infinispan Behavior in Rebalancing & Async mode

I am new to Infinispan. Even after going through Infinispan User Guide & googling through, I am not able to figure out behavior of Infinispan in below cases :

1) Does it lock on HotRod Client reading when rebalancing is taking place ?

2) How does Infinispan behaves with REPL mode with async & nearCache at HotRod client end ? (I found that if nearCache is disabled then it can get the data, but not with nearCache. Does it have to anything with nearCache update?)

Server Code :

GlobalConfigurationBuilder globalConfig = GlobalConfigurationBuilder.defaultClusteredBuilder();
globalConfig.transport().clusterName("infiniReplicatedCluster").globalJmxStatistics().enable().allowDuplicateDomains(Boolean.TRUE);
ConfigurationBuilder configBuilder = new ConfigurationBuilder();
EmbeddedCacheManager embeddedCacheManager = new DefaultCacheManager(globalConfig.build());

configBuilder.dataContainer().compatibility().enable().clustering().cacheMode(CacheMode.REPL_ASYNC)
    .async().replQueueInterval(120, TimeUnit.SECONDS).useReplQueue(true).hash();
embeddedCacheManager.defineConfiguration("TestCache", configBuilder.build());

Cache<String, TopologyData> cache = embeddedCacheManager.getCache("TestCache");
cache.put("00000", new TopologyData());

HotRodServerConfiguration build = new HotRodServerConfigurationBuilder().build();
HotRodServer server = new HotRodServer();
server.start(build, embeddedCacheManager);

Client Code :

ConfigurationBuilder remoteBuilder = new ConfigurationBuilder();
remoteBuilder.nearCache().mode(NearCacheMode.EAGER).maxEntries(100);
RemoteCacheManager remoteCacheManager = new RemoteCacheManager(remoteBuilder.build());
remoteCache = remoteCacheManager.getCache("TestCache");
System.out.println(remoteCache.get(fetchKey));

With above code, scenarios & results are listed below(all the run were done multiple times, resulting in same result) :

-Without nearCache 1 Key --> got value as expected

-With nearCache (LAZY/EAGER) 1 key --> null

-In same run, same Key two times With nearCache (LAZY/EAGER) --> null(first time) - expected value(next time)

Clarification needed : If a sample code to re-verify HotRod client's load balancing(RoundRobin) behavior in DIST mode. (I am successfully able to check it with REPL mode, & it works as it claims)

Upvotes: 0

Views: 649

Answers (1)

Tristan Tarrant
Tristan Tarrant

Reputation: 1504

  1. State transfer in Infinispan is non-blocking
  2. Not sure I understand completely: you mean to say that, when enabling near caching on a Hot Rod client, reading from an async REPL cache doesn't work ? Does it just hang ? Do you have code that you can share ?

A clarification: Hot Rod goes to the primary owner both in DIST and REPL mode (REPL is simply a special DIST mode where number of owners is equal to the size of the cluster) hashed according to the key and will only use Round Robin if the primary is not responding.

Upvotes: 1

Related Questions