Search in sources :

Example 1 with RendezvousAffinityFunction

use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.

the class IgnitePdsMultiNodePutGetRestartTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);
    DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setMaxSize(100 * 1024 * 1024).setPersistenceEnabled(true)).setWalMode(WALMode.LOG_ONLY);
    cfg.setDataStorageConfiguration(memCfg);
    CacheConfiguration ccfg = new CacheConfiguration();
    ccfg.setIndexedTypes(Integer.class, DbValue.class);
    ccfg.setRebalanceMode(CacheRebalanceMode.NONE);
    ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
    ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    cfg.setCacheConfiguration(ccfg);
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    discoSpi.setIpFinder(IP_FINDER);
    cfg.setDiscoverySpi(discoSpi);
    cfg.setMarshaller(null);
    BinaryConfiguration bCfg = new BinaryConfiguration();
    bCfg.setCompactFooter(false);
    cfg.setBinaryConfiguration(bCfg);
    return cfg;
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryConfiguration(org.apache.ignite.configuration.BinaryConfiguration) RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 2 with RendezvousAffinityFunction

use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.

the class SVMMultiClassClassificationExample method getTestCache.

/**
 * Fills cache with data and returns it.
 *
 * @param ignite Ignite instance.
 * @return Filled Ignite Cache.
 */
private static IgniteCache<Integer, double[]> getTestCache(Ignite ignite) {
    CacheConfiguration<Integer, double[]> cacheConfiguration = new CacheConfiguration<>();
    cacheConfiguration.setName("TEST_" + UUID.randomUUID());
    cacheConfiguration.setAffinity(new RendezvousAffinityFunction(false, 10));
    IgniteCache<Integer, double[]> cache = ignite.createCache(cacheConfiguration);
    for (int i = 0; i < data.length; i++) cache.put(i, data[i]);
    return cache;
}
Also used : RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 3 with RendezvousAffinityFunction

use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.

the class DistributedLinearRegressionWithLSQRTrainerAndNormalizationExample method getTestCache.

/**
 * Fills cache with data and returns it.
 *
 * @param ignite Ignite instance.
 * @return Filled Ignite Cache.
 */
private static IgniteCache<Integer, double[]> getTestCache(Ignite ignite) {
    CacheConfiguration<Integer, double[]> cacheConfiguration = new CacheConfiguration<>();
    cacheConfiguration.setName("TEST_" + UUID.randomUUID());
    cacheConfiguration.setAffinity(new RendezvousAffinityFunction(false, 10));
    IgniteCache<Integer, double[]> cache = ignite.createCache(cacheConfiguration);
    for (int i = 0; i < data.length; i++) cache.put(i, data[i]);
    return cache;
}
Also used : RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 4 with RendezvousAffinityFunction

use of org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction in project ignite by apache.

the class SVMBinaryClassificationExample method getTestCache.

/**
 * Fills cache with data and returns it.
 *
 * @param ignite Ignite instance.
 * @return Filled Ignite Cache.
 */
private static IgniteCache<Integer, double[]> getTestCache(Ignite ignite) {
    CacheConfiguration<Integer, double[]> cacheConfiguration = new CacheConfiguration<>();
    cacheConfiguration.setName("TEST_" + UUID.randomUUID());
    cacheConfiguration.setAffinity(new RendezvousAffinityFunction(false, 10));
    IgniteCache<Integer, double[]> cache = ignite.createCache(cacheConfiguration);
    for (int i = 0; i < data.length; i++) cache.put(i, data[i]);
    return cache;
}
Also used : RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 5 with RendezvousAffinityFunction

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;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Aggregations

RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)353 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)290 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)160 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)103 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)99 Test (org.junit.Test)90 IgniteEx (org.apache.ignite.internal.IgniteEx)70 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)53 Ignite (org.apache.ignite.Ignite)42 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)30 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)27 TestRecordingCommunicationSpi (org.apache.ignite.internal.TestRecordingCommunicationSpi)26 Random (java.util.Random)24 ArrayList (java.util.ArrayList)23 IgniteCache (org.apache.ignite.IgniteCache)23 QueryEntity (org.apache.ignite.cache.QueryEntity)21 GridCacheDatabaseSharedManager (org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager)20 List (java.util.List)16 CountDownLatch (java.util.concurrent.CountDownLatch)16 IgniteException (org.apache.ignite.IgniteException)16