use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class GridCacheClientModesAbstractSelfTest method cacheConfiguration.
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
CacheConfiguration cfg = super.cacheConfiguration(igniteInstanceName);
cfg.setCacheStoreFactory(null);
cfg.setReadThrough(false);
cfg.setWriteThrough(false);
cfg.setBackups(1);
if (cfg.getCacheMode() == REPLICATED)
cfg.setAffinity(null);
else
cfg.setAffinity(new RendezvousAffinityFunction(false, 32));
return cfg;
}
use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class GridCachePartitionedTxSalvageSelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
// Discovery.
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
c.setDiscoverySpi(disco);
CacheConfiguration cc = defaultCacheConfiguration();
cc.setCacheMode(PARTITIONED);
cc.setAffinity(new RendezvousAffinityFunction(false, 18));
cc.setBackups(1);
cc.setRebalanceMode(SYNC);
c.setCacheConfiguration(cc);
return c;
}
use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class GridCachePartitionedOptimisticTxNodeRestartTest method cacheConfiguration.
/** {@inheritDoc} */
@Override
protected CacheConfiguration cacheConfiguration() {
CacheConfiguration cc = defaultCacheConfiguration();
cc.setName(CACHE_NAME);
cc.setCacheMode(PARTITIONED);
cc.setWriteSynchronizationMode(FULL_SYNC);
cc.setRebalanceMode(rebalancMode);
cc.setRebalanceBatchSize(rebalancBatchSize);
cc.setAffinity(new RendezvousAffinityFunction(false, partitions));
cc.setBackups(backups);
cc.setNearConfiguration(nearEnabled() ? new NearCacheConfiguration() : null);
return cc;
}
use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class IgniteDbAbstractTest method getConfiguration.
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
MemoryConfiguration dbCfg = new MemoryConfiguration();
dbCfg.setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
if (isLargePage())
dbCfg.setPageSize(16 * 1024);
else
dbCfg.setPageSize(1024);
configure(dbCfg);
cfg.setMemoryConfiguration(dbCfg);
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
if (indexingEnabled())
ccfg.setIndexedTypes(Integer.class, DbValue.class);
ccfg.setAtomicityMode(TRANSACTIONAL);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
ccfg.setRebalanceMode(SYNC);
ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
CacheConfiguration ccfg2 = new CacheConfiguration("non-primitive");
if (indexingEnabled())
ccfg2.setIndexedTypes(DbKey.class, DbValue.class);
ccfg2.setAtomicityMode(TRANSACTIONAL);
ccfg2.setWriteSynchronizationMode(FULL_SYNC);
ccfg2.setRebalanceMode(SYNC);
ccfg2.setAffinity(new RendezvousAffinityFunction(false, 32));
CacheConfiguration ccfg3 = new CacheConfiguration("large");
if (indexingEnabled())
ccfg3.setIndexedTypes(Integer.class, LargeDbValue.class);
ccfg3.setAtomicityMode(TRANSACTIONAL);
ccfg3.setWriteSynchronizationMode(FULL_SYNC);
ccfg3.setRebalanceMode(SYNC);
ccfg3.setAffinity(new RendezvousAffinityFunction(false, 32));
CacheConfiguration ccfg4 = new CacheConfiguration("tiny");
ccfg4.setAtomicityMode(TRANSACTIONAL);
ccfg4.setWriteSynchronizationMode(FULL_SYNC);
ccfg4.setRebalanceMode(SYNC);
ccfg4.setAffinity(new RendezvousAffinityFunction(1, null));
CacheConfiguration ccfg5 = new CacheConfiguration("atomic");
if (indexingEnabled())
ccfg5.setIndexedTypes(DbKey.class, DbValue.class);
ccfg5.setAtomicityMode(ATOMIC);
ccfg5.setWriteSynchronizationMode(FULL_SYNC);
ccfg5.setRebalanceMode(SYNC);
ccfg5.setAffinity(new RendezvousAffinityFunction(false, 32));
cfg.setCacheConfiguration(ccfg, ccfg2, ccfg3, ccfg4, ccfg5);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(discoSpi);
cfg.setMarshaller(null);
configure(cfg);
return cfg;
}
use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class IgniteDbDynamicCacheSelfTest method testMultipleDynamicCaches.
/**
* @throws Exception If failed.
*/
public void testMultipleDynamicCaches() throws Exception {
int caches = 10;
int entries = 10;
startGrids(1);
Ignite ignite = ignite(0);
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
ccfg.setRebalanceMode(CacheRebalanceMode.NONE);
ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
ccfg.setIndexedTypes(Integer.class, String.class);
long finishTime = U.currentTimeMillis() + 20_000;
int iteration = 0;
while (U.currentTimeMillis() < finishTime) {
System.out.println("Iteration: " + iteration);
for (int i = 0; i < caches; i++) {
ccfg.setName("cache" + i);
IgniteCache cache = ignite.createCache(ccfg);
for (int j = 0; j < entries; j++) cache.put(j, "val " + j);
ignite.destroyCache("cache" + i);
}
iteration++;
}
}
Aggregations