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

The following examples show how to use org.apache.ignite.configuration.CacheConfiguration#setRebalanceBatchSize() . 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: GridCachePreloadRestartAbstractSelfTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);

    c.setDeploymentMode(CONTINUOUS);

    // Cache.
    CacheConfiguration cc = defaultCacheConfiguration();

    cc.setName(CACHE_NAME);
    cc.setCacheMode(PARTITIONED);
    cc.setWriteSynchronizationMode(FULL_SYNC);
    cc.setRebalanceMode(preloadMode);
    cc.setRebalanceBatchSize(preloadBatchSize);
    cc.setAffinity(new RendezvousAffinityFunction(false, partitions));
    cc.setBackups(backups);
    cc.setAtomicityMode(TRANSACTIONAL);

    if (!nearEnabled())
        cc.setNearConfiguration(null);

    c.setCacheConfiguration(cc);

    return c;
}
 
Example 2
Source File: GridCachePartitionedNodeRestartTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override protected CacheConfiguration cacheConfiguration() {
    CacheConfiguration cc = defaultCacheConfiguration();

    cc.setName(CACHE_NAME);
    cc.setAtomicityMode(atomicityMode());
    cc.setCacheMode(PARTITIONED);
    cc.setWriteSynchronizationMode(FULL_SYNC);
    cc.setNearConfiguration(null);
    cc.setRebalanceMode(rebalancMode);
    cc.setRebalanceBatchSize(rebalancBatchSize);
    cc.setAffinity(new RendezvousAffinityFunction(false, partitions));
    cc.setBackups(backups);

    return cc;
}
 
Example 3
Source File: GridCachePartitionedOptimisticTxNodeRestartTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@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;
}
 
Example 4
Source File: GridCacheSyncReplicatedPreloadSelfTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    CacheConfiguration cacheCfg = defaultCacheConfiguration();

    cacheCfg.setCacheMode(REPLICATED);
    cacheCfg.setNearConfiguration(null);
    cacheCfg.setWriteSynchronizationMode(FULL_SYNC);

    // This property is essential for this test.
    cacheCfg.setRebalanceMode(SYNC);

    cacheCfg.setRebalanceBatchSize(10000);

    cfg.setCacheConfiguration(cacheCfg);
    cfg.setDeploymentMode(CONTINUOUS);

    return cfg;
}
 
Example 5
Source File: GridCacheDhtPreloadUnloadSelfTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);

    CacheConfiguration cc = defaultCacheConfiguration();

    cc.setCacheMode(PARTITIONED);
    cc.setRebalanceBatchSize(preloadBatchSize);
    cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    cc.setRebalanceMode(preloadMode);
    cc.setAffinity(new RendezvousAffinityFunction(false, partitions));
    cc.setBackups(backups);
    cc.setAtomicityMode(TRANSACTIONAL);

    if (lbean != null)
        c.setLifecycleBeans(lbean);

    c.setCacheConfiguration(cc);
    c.setDeploymentMode(CONTINUOUS);
    c.setNetworkTimeout(netTimeout);

    return c;
}
 
Example 6
Source File: GridCacheDhtPreloadBigDataSelfTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);

    CacheConfiguration cc = defaultCacheConfiguration();

    cc.setCacheMode(PARTITIONED);
    cc.setRebalanceBatchSize(preloadBatchSize);
    cc.setWriteSynchronizationMode(FULL_SYNC);
    cc.setRebalanceMode(preloadMode);
    cc.setAffinity(new RendezvousAffinityFunction(false, partitions));
    cc.setBackups(backups);

    if (lbean != null)
        c.setLifecycleBeans(lbean);

    c.setCacheConfiguration(cc);
    c.setDeploymentMode(CONTINUOUS);
    c.setNetworkTimeout(1000);

    return c;
}
 
Example 7
Source File: GridCacheReplicatedPreloadSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * Gets cache configuration for grid with specified name.
 *
 * @param igniteInstanceName Ignite instance name.
 * @return Cache configuration.
 */
CacheConfiguration cacheConfiguration(String igniteInstanceName) {
    CacheConfiguration cacheCfg = defaultCacheConfiguration();

    cacheCfg.setCacheMode(REPLICATED);
    cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
    cacheCfg.setRebalanceMode(preloadMode);
    cacheCfg.setRebalanceBatchSize(batchSize);

    if (extClassloadingAtCfg)
        loadExternalClassesToCfg(cacheCfg);

    return cacheCfg;
}
 
Example 8
Source File: GridCacheDhtPreloadSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * Gets cache configuration for grid with given name.
 *
 * @param igniteInstanceName Ignite instance name.
 * @return Cache configuration.
 */
protected CacheConfiguration cacheConfiguration(String igniteInstanceName) {
    CacheConfiguration cacheCfg = defaultCacheConfiguration();

    cacheCfg.setCacheMode(PARTITIONED);
    cacheCfg.setRebalanceBatchSize(preloadBatchSize);
    cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
    cacheCfg.setRebalanceMode(preloadMode);
    cacheCfg.setAffinity(new RendezvousAffinityFunction(false, partitions));
    cacheCfg.setBackups(backups);
    cacheCfg.setOnheapCacheEnabled(onheapCacheEnabled());

    return cacheCfg;
}
 
Example 9
Source File: GridCacheDhtPreloadStartStopSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    CacheConfiguration[] cacheCfgs = new CacheConfiguration[cacheCnt];

    for (int i = 0; i < cacheCnt; i++) {
        CacheConfiguration cacheCfg = defaultCacheConfiguration();

        cacheCfg.setName("partitioned-" + i);

        cacheCfg.setCacheMode(PARTITIONED);
        cacheCfg.setRebalanceBatchSize(preloadBatchSize);
        cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
        cacheCfg.setRebalanceMode(preloadMode);
        cacheCfg.setAffinity(new RendezvousAffinityFunction(false, partitions));
        cacheCfg.setBackups(backups);
        cacheCfg.setAtomicityMode(TRANSACTIONAL);

        cacheCfgs[i] = cacheCfg;
    }

    cfg.setCacheConfiguration(cacheCfgs);
    cfg.setDeploymentMode(CONTINUOUS);

    return cfg;
}
 
Example 10
Source File: GridCacheReplicatedNodeRestartSelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected CacheConfiguration cacheConfiguration() {
    CacheConfiguration cc = defaultCacheConfiguration();

    cc.setNearConfiguration(null);

    cc.setAtomicityMode(atomicityMode());

    cc.setName(CACHE_NAME);

    cc.setCacheMode(REPLICATED);

    cc.setWriteSynchronizationMode(FULL_SYNC);

    cc.setRebalanceMode(SYNC);

    cc.setRebalanceBatchSize(20);

    return cc;
}
 
Example 11
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;
}
 
Example 12
Source File: CacheRentingStateRepairTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);

    ccfg.setAffinity(new RendezvousAffinityFunction(false, PARTS).setPartitions(64));

    ccfg.setOnheapCacheEnabled(false);

    ccfg.setBackups(1);

    ccfg.setRebalanceBatchSize(100);

    cfg.setCommunicationSpi(new TestRecordingCommunicationSpi());

    cfg.setCacheConfiguration(ccfg);

    cfg.setActiveOnStart(false);

    cfg.setConsistentId(igniteInstanceName);

    long sz = 100 * 1024 * 1024;

    DataStorageConfiguration memCfg = new DataStorageConfiguration().setPageSize(1024)
        .setDefaultDataRegionConfiguration(
            new DataRegionConfiguration().setPersistenceEnabled(true).setInitialSize(sz).setMaxSize(sz))
        .setWalSegmentSize(8 * 1024 * 1024)
        .setWalMode(WALMode.LOG_ONLY).setCheckpointFrequency(24L * 60 * 60 * 1000);

    cfg.setDataStorageConfiguration(memCfg);

    return cfg;
}