use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class GridCacheRebalancingOrderingTest method getCacheConfiguration.
/**
* @return Cache configuration used by test.
* @see #getConfiguration().
*/
protected CacheConfiguration<IntegerKey, Integer> getCacheConfiguration() {
CacheConfiguration<IntegerKey, Integer> cfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
cfg.setAtomicityMode(TRANSACTIONAL ? CacheAtomicityMode.TRANSACTIONAL : CacheAtomicityMode.ATOMIC);
cfg.setCacheMode(CacheMode.PARTITIONED);
cfg.setName(TEST_CACHE_NAME);
cfg.setAffinity(new RendezvousAffinityFunction(true, /* machine-safe */
271));
cfg.setBackups(1);
cfg.setRebalanceMode(CacheRebalanceMode.SYNC);
cfg.setWriteSynchronizationMode(FULL_SYNC);
return cfg;
}
use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class IgnitePdsBinaryMetadataOnClusterRestartTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
if (customWorkSubDir != null)
cfg.setWorkDirectory(Paths.get(U.defaultWorkDirectory(), customWorkSubDir).toString());
cfg.setClientMode(clientMode);
cfg.setDataStorageConfiguration(new DataStorageConfiguration().setWalMode(WALMode.LOG_ONLY).setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true).setMaxSize(100 * 1024 * 1024)));
BinaryConfiguration bCfg = new BinaryConfiguration();
BinaryTypeConfiguration binaryEnumCfg = new BinaryTypeConfiguration(EnumType.class.getName());
binaryEnumCfg.setEnum(true);
binaryEnumCfg.setEnumValues(F.asMap(EnumType.ENUM_VAL_0.name(), EnumType.ENUM_VAL_0.ordinal(), EnumType.ENUM_VAL_1.name(), EnumType.ENUM_VAL_1.ordinal()));
bCfg.setTypeConfigurations(Arrays.asList(binaryEnumCfg));
cfg.setBinaryConfiguration(bCfg);
CacheKeyConfiguration dynamicMetaKeyCfg = new CacheKeyConfiguration(DYNAMIC_TYPE_NAME, DYNAMIC_INT_FIELD_NAME);
cfg.setCacheKeyConfiguration(dynamicMetaKeyCfg);
cfg.setCacheConfiguration(new CacheConfiguration().setName(CACHE_NAME).setAffinity(new RendezvousAffinityFunction()).setCacheMode(CacheMode.REPLICATED));
return cfg;
}
use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.
the class IgniteCheckpointDirtyPagesForLowLoadTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
List<CacheConfiguration> ccfgs = new ArrayList<>();
for (int g = 0; g < GROUPS; g++) {
for (int i = 0; i < CACHES_IN_GRP; i++) {
CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>().setName("dummyCache" + i + "." + g).setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL).setGroupName("dummyGroup" + g).setAffinity(new RendezvousAffinityFunction(false, PARTS));
ccfgs.add(ccfg);
}
}
cfg.setCacheConfiguration(ccfgs.toArray(new CacheConfiguration[ccfgs.size()]));
DataStorageConfiguration dsCfg = new DataStorageConfiguration();
// smaller page to reduce overhead to short values
dsCfg.setPageSize(1024);
dsCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true));
dsCfg.setCheckpointFrequency(500);
dsCfg.setWalMode(WALMode.LOG_ONLY);
dsCfg.setWalHistorySize(1);
cfg.setDataStorageConfiguration(dsCfg);
return cfg;
}
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);
DataStorageConfiguration dbCfg = new DataStorageConfiguration();
if (client)
cfg.setClientMode(true);
dbCfg.setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
if (isLargePage())
dbCfg.setPageSize(16 * 1024);
else
dbCfg.setPageSize(4 * 1024);
dbCfg.setWalMode(WALMode.LOG_ONLY);
dbCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true).setName("default"));
configure(dbCfg);
cfg.setDataStorageConfiguration(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));
if (!client)
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);
ignite.active(true);
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