Java Code Examples for org.apache.ignite.configuration.CacheConfiguration#setRebalanceOrder()

The following examples show how to use org.apache.ignite.configuration.CacheConfiguration#setRebalanceOrder() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IgnitionEx.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * Creates utility system cache configuration.
 *
 * @return Utility system cache configuration.
 */
private static CacheConfiguration utilitySystemCache() {
    CacheConfiguration cache = new CacheConfiguration();

    cache.setName(CU.UTILITY_CACHE_NAME);
    cache.setCacheMode(REPLICATED);
    cache.setAtomicityMode(TRANSACTIONAL);
    cache.setRebalanceMode(SYNC);
    cache.setWriteSynchronizationMode(FULL_SYNC);
    cache.setAffinity(new RendezvousAffinityFunction(false, 100));
    cache.setNodeFilter(CacheConfiguration.ALL_NODES);
    cache.setRebalanceOrder(-2); //Prior to user caches.
    cache.setCopyOnRead(false);

    return cache;
}
 
Example 2
Source File: GridCacheOrderedPreloadingSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @param cacheMode Cache mode.
 * @param preloadOrder Preload order.
 * @param name Cache name.
 * @return Cache configuration.
 */
private CacheConfiguration cacheConfig(CacheMode cacheMode, int preloadOrder, String name) {
    CacheConfiguration cfg = defaultCacheConfiguration();

    cfg.setName(name);
    cfg.setCacheMode(cacheMode);
    cfg.setRebalanceOrder(preloadOrder);
    cfg.setRebalanceMode(ASYNC);
    return cfg;
}
 
Example 3
Source File: GridCacheRebalancingSyncSelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration iCfg = super.getConfiguration(igniteInstanceName);

    if (MvccFeatureChecker.forcedMvcc()) {
        iCfg.setDataStorageConfiguration(new DataStorageConfiguration()
            .setDefaultDataRegionConfiguration(
                new DataRegionConfiguration().setMaxSize(400L * 1024 * 1024)
            ));
    }

    TcpCommunicationSpi commSpi = new CollectingCommunicationSpi();
    commSpi.setTcpNoDelay(true);

    iCfg.setCommunicationSpi(commSpi);

    CacheConfiguration<Integer, Integer> cachePCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);

    cachePCfg.setName(CACHE_NAME_DHT_PARTITIONED);
    cachePCfg.setCacheMode(CacheMode.PARTITIONED);
    cachePCfg.setRebalanceMode(CacheRebalanceMode.SYNC);
    cachePCfg.setBackups(1);
    cachePCfg.setRebalanceBatchSize(1);
    cachePCfg.setRebalanceBatchesPrefetchCount(1);
    cachePCfg.setRebalanceOrder(2);
    cachePCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
    cachePCfg.setAffinity(new RendezvousAffinityFunction().setPartitions(32));

    CacheConfiguration<Integer, Integer> cachePCfg2 = new CacheConfiguration<>(DEFAULT_CACHE_NAME);

    cachePCfg2.setName(CACHE_NAME_DHT_PARTITIONED_2);
    cachePCfg2.setCacheMode(CacheMode.PARTITIONED);
    cachePCfg2.setRebalanceMode(CacheRebalanceMode.SYNC);
    cachePCfg2.setBackups(1);
    cachePCfg2.setRebalanceOrder(2);
    cachePCfg2.setRebalanceDelay(SF.applyLB(5000, 500));
    cachePCfg2.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
    cachePCfg2.setAffinity(new RendezvousAffinityFunction().setPartitions(32));

    CacheConfiguration<Integer, Integer> cacheRCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);

    cacheRCfg.setName(CACHE_NAME_DHT_REPLICATED);
    cacheRCfg.setCacheMode(CacheMode.REPLICATED);
    cacheRCfg.setRebalanceMode(CacheRebalanceMode.SYNC);
    cacheRCfg.setRebalanceBatchSize(1);
    cacheRCfg.setRebalanceBatchesPrefetchCount(Integer.MAX_VALUE);
    cacheRCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
    cacheRCfg.setAffinity(new RendezvousAffinityFunction().setPartitions(32));

    CacheConfiguration<Integer, Integer> cacheRCfg2 = new CacheConfiguration<>(DEFAULT_CACHE_NAME);

    cacheRCfg2.setName(CACHE_NAME_DHT_REPLICATED_2);
    cacheRCfg2.setCacheMode(CacheMode.REPLICATED);
    cacheRCfg2.setRebalanceMode(CacheRebalanceMode.SYNC);
    cacheRCfg2.setRebalanceOrder(4);
    cacheRCfg2.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
    cacheRCfg2.setAffinity(new RendezvousAffinityFunction().setPartitions(32));

    iCfg.setCacheConfiguration(cachePCfg, cachePCfg2, cacheRCfg, cacheRCfg2);

    iCfg.setRebalanceThreadPoolSize(3);

    return iCfg;
}