use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class GridCacheDhtPreloadPutGetSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
assert preloadMode != null;
CacheConfiguration cacheCfg = defaultCacheConfiguration();
cacheCfg.setCacheMode(PARTITIONED);
cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
cacheCfg.setRebalanceMode(preloadMode);
cacheCfg.setBackups(backups);
cacheCfg.setAffinity(new RendezvousAffinityFunction());
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
cfg.setDiscoverySpi(disco);
cfg.setCacheConfiguration(cacheCfg);
return cfg;
}
use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class GridCacheDhtPreloadSelfTest method cacheConfiguration.
/**
* Gets cache configuration for grid with given name.
*
* @param igniteInstanceName Ignite instance name.
* @return Cache configuration.
*/
protected CacheConfiguration cacheConfiguration(String igniteInstanceName) {
CacheConfiguration cacheCfg = defaultCacheConfiguration();
cacheCfg.setCacheMode(PARTITIONED);
cacheCfg.setRebalanceBatchSize(preloadBatchSize);
cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
cacheCfg.setRebalanceMode(preloadMode);
cacheCfg.setAffinity(new RendezvousAffinityFunction(false, partitions));
cacheCfg.setBackups(backups);
cacheCfg.setOnheapCacheEnabled(onheapCacheEnabled());
return cacheCfg;
}
use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class GridCacheDhtPreloadUnloadSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
CacheConfiguration cc = defaultCacheConfiguration();
cc.setCacheMode(PARTITIONED);
cc.setRebalanceBatchSize(preloadBatchSize);
cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
cc.setRebalanceMode(preloadMode);
cc.setAffinity(new RendezvousAffinityFunction(false, partitions));
cc.setBackups(backups);
cc.setAtomicityMode(TRANSACTIONAL);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
if (lbean != null)
c.setLifecycleBeans(lbean);
c.setDiscoverySpi(disco);
c.setCacheConfiguration(cc);
c.setDeploymentMode(CONTINUOUS);
c.setNetworkTimeout(netTimeout);
return c;
}
use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class GridCacheDhtPreloadMessageCountTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
assert preloadMode != null;
CacheConfiguration cc = defaultCacheConfiguration();
cc.setCacheMode(PARTITIONED);
cc.setWriteSynchronizationMode(FULL_SYNC);
cc.setRebalanceMode(preloadMode);
cc.setAffinity(new RendezvousAffinityFunction(false, 521));
cc.setBackups(1);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
c.setFailureDetectionTimeout(Integer.MAX_VALUE);
c.setDiscoverySpi(disco);
c.setCacheConfiguration(cc);
TestRecordingCommunicationSpi commSpi = new TestRecordingCommunicationSpi();
commSpi.record(GridDhtPartitionsSingleMessage.class);
c.setCommunicationSpi(commSpi);
return c;
}
use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class IgnitePdsCacheRebalancingAbstractTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
cfg.setConsistentId(gridName);
CacheConfiguration ccfg1 = cacheConfiguration(cacheName).setPartitionLossPolicy(PartitionLossPolicy.READ_WRITE_SAFE).setBackups(2).setRebalanceMode(CacheRebalanceMode.ASYNC).setIndexedTypes(Integer.class, Integer.class).setAffinity(new RendezvousAffinityFunction(false, 32)).setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
CacheConfiguration ccfg2 = cacheConfiguration("indexed");
ccfg2.setBackups(1);
ccfg2.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
QueryEntity qryEntity = new QueryEntity(Integer.class.getName(), TestValue.class.getName());
LinkedHashMap<String, String> fields = new LinkedHashMap<>();
fields.put("v1", Integer.class.getName());
fields.put("v2", Integer.class.getName());
qryEntity.setFields(fields);
QueryIndex qryIdx = new QueryIndex("v1", true);
qryEntity.setIndexes(Collections.singleton(qryIdx));
ccfg2.setQueryEntities(Collections.singleton(qryEntity));
// Do not start filtered cache on coordinator.
if (gridName.endsWith("0")) {
cfg.setCacheConfiguration(ccfg1, ccfg2);
} else {
CacheConfiguration ccfg3 = cacheConfiguration("filtered");
ccfg3.setPartitionLossPolicy(PartitionLossPolicy.READ_ONLY_SAFE);
ccfg3.setBackups(1);
ccfg3.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
ccfg3.setNodeFilter(new CoordinatorNodeFilter());
cfg.setCacheConfiguration(ccfg1, ccfg2, ccfg3);
}
DataStorageConfiguration memCfg = new DataStorageConfiguration();
memCfg.setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
memCfg.setPageSize(1024);
memCfg.setWalMode(WALMode.LOG_ONLY);
DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();
memPlcCfg.setName("dfltDataRegion");
memPlcCfg.setMaxSize(150 * 1024 * 1024);
memPlcCfg.setInitialSize(100 * 1024 * 1024);
memPlcCfg.setSwapPath("work/swap");
memPlcCfg.setPersistenceEnabled(true);
memCfg.setDefaultDataRegionConfiguration(memPlcCfg);
cfg.setDataStorageConfiguration(memCfg);
cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(IP_FINDER));
return cfg;
}
Aggregations