use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class GridCacheDhtPreloadPerformanceTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
CacheConfiguration cc = defaultCacheConfiguration();
cc.setCacheMode(CacheMode.PARTITIONED);
cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
cc.setRebalanceMode(CacheRebalanceMode.SYNC);
cc.setAffinity(new RendezvousAffinityFunction(false, 1300));
cc.setBackups(2);
CacheConfiguration cc1 = defaultCacheConfiguration();
cc1.setName("cc1");
cc1.setCacheMode(CacheMode.PARTITIONED);
cc1.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
cc1.setRebalanceMode(CacheRebalanceMode.SYNC);
cc1.setAffinity(new RendezvousAffinityFunction(false, 1300));
cc1.setBackups(2);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
c.setDiscoverySpi(disco);
c.setIgfsThreadPoolSize(1);
c.setSystemThreadPoolSize(2);
c.setPublicThreadPoolSize(2);
c.setManagementThreadPoolSize(1);
c.setUtilityCachePoolSize(2);
c.setPeerClassLoadingThreadPoolSize(1);
c.setCacheConfiguration(cc, cc1);
TcpCommunicationSpi comm = new TcpCommunicationSpi();
comm.setSharedMemoryPort(-1);
c.setCommunicationSpi(comm);
return c;
}
use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class IgnitePdsDiskErrorsRecoveringTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
DataStorageConfiguration dsCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setMaxSize(100 * 1024 * 1024).setPersistenceEnabled(true)).setWalMode(WALMode.LOG_ONLY).setWalCompactionEnabled(false).setWalSegmentSize(WAL_SEGMENT_SIZE).setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
if (failPageStoreDiskOperations)
dsCfg.setFileIOFactory(new LimitedSizeFileIOFactory(new RandomAccessFileIOFactory(), diskSpaceBytes));
cfg.setDataStorageConfiguration(dsCfg);
CacheConfiguration cacheCfg = new CacheConfiguration(CACHE_NAME).setRebalanceMode(CacheRebalanceMode.NONE).setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL).setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC).setAffinity(new RendezvousAffinityFunction(false, 1));
cfg.setCacheConfiguration(cacheCfg);
return cfg;
}
use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class IgnitePdsNoActualWalHistoryTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
CacheConfiguration<Integer, IndexedObject> ccfg = new CacheConfiguration<>(CACHE_NAME);
ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
ccfg.setRebalanceMode(CacheRebalanceMode.SYNC);
ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
cfg.setCacheConfiguration(ccfg);
DataStorageConfiguration dbCfg = new DataStorageConfiguration();
dbCfg.setPageSize(4 * 1024);
cfg.setDataStorageConfiguration(dbCfg);
dbCfg.setWalSegmentSize(4 * 1024 * 1024).setWalHistorySize(2).setWalSegments(10).setWalMode(WALMode.LOG_ONLY).setDefaultDataRegionConfiguration(new DataRegionConfiguration().setMaxSize(100 * 1024 * 1024).setPersistenceEnabled(true));
cfg.setMarshaller(null);
BinaryConfiguration binCfg = new BinaryConfiguration();
binCfg.setCompactFooter(false);
cfg.setBinaryConfiguration(binCfg);
return cfg;
}
use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class IgniteWalHistoryReservationsTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
cfg.setClientMode(client);
cfg.setConsistentId("NODE$" + gridName.charAt(gridName.length() - 1));
DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setMaxSize(200 * 1024 * 1024).setPersistenceEnabled(true)).setWalMode(WALMode.LOG_ONLY);
cfg.setDataStorageConfiguration(memCfg);
CacheConfiguration ccfg1 = new CacheConfiguration();
ccfg1.setName("cache1");
ccfg1.setBackups(1);
ccfg1.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
ccfg1.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
ccfg1.setAffinity(new RendezvousAffinityFunction(false, 32));
cfg.setCacheConfiguration(ccfg1);
return cfg;
}
use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class IgniteWalRecoverySeveralRestartsTest method testWalRecoveryWithDynamicCache.
/**
* @throws Exception if failed.
*/
public void testWalRecoveryWithDynamicCache() throws Exception {
try {
IgniteEx ignite = startGrid(1);
ignite.active(true);
CacheConfiguration<Integer, IndexedObject> dynCacheCfg = new CacheConfiguration<>();
dynCacheCfg.setName("dyncache");
dynCacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
dynCacheCfg.setRebalanceMode(CacheRebalanceMode.NONE);
dynCacheCfg.setIndexedTypes(Integer.class, IndexedObject.class);
dynCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
// 64 per node
dynCacheCfg.setAffinity(new RendezvousAffinityFunction(false, 64 * 4));
dynCacheCfg.setReadFromBackup(true);
ignite.getOrCreateCache(dynCacheCfg);
try (IgniteDataStreamer<Integer, IndexedObject> dataLdr = ignite.dataStreamer("dyncache")) {
for (int i = 0; i < KEYS_COUNT; ++i) {
if (i % (KEYS_COUNT / 100) == 0)
info("Loading " + i * 100 / KEYS_COUNT + "%");
dataLdr.addData(i, new IndexedObject(i));
}
}
for (int restartCnt = 0; restartCnt < 5; ++restartCnt) {
stopGrid(1, true);
info("Restart #" + restartCnt);
U.sleep(500);
ignite = startGrid(1);
ignite.active(true);
ThreadLocalRandom locRandom = ThreadLocalRandom.current();
IgniteCache<Integer, IndexedObject> cache = ignite.getOrCreateCache(dynCacheCfg);
for (int i = 0; i < KEYS_COUNT; ++i) assertNotNull(cache.get(locRandom.nextInt(KEYS_COUNT)));
}
} finally {
stopAllGrids();
}
}
Aggregations