Search in sources :

Example 11 with DataStorageConfiguration

use of org.apache.ignite.configuration.DataStorageConfiguration in project ignite by apache.

the class IgniteStableBaselineBinObjFieldsQuerySelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    cfg.setDataStorageConfiguration(new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setMaxSize(200 * 1024 * 1024).setPersistenceEnabled(true)));
    return cfg;
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration)

Example 12 with DataStorageConfiguration

use of org.apache.ignite.configuration.DataStorageConfiguration in project ignite by apache.

the class GridDiscoveryManager method configuredOffheap.

/**
 * @return Configured data regions offheap memory in bytes.
 */
private long configuredOffheap() {
    DataStorageConfiguration memCfg = ctx.config().getDataStorageConfiguration();
    if (memCfg == null)
        return 0;
    long res = memCfg.getDefaultDataRegionConfiguration().getMaxSize();
    DataRegionConfiguration[] dataRegions = memCfg.getDataRegionConfigurations();
    if (dataRegions != null) {
        for (DataRegionConfiguration dataReg : dataRegions) res += dataReg.getMaxSize();
    }
    return res;
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration)

Example 13 with DataStorageConfiguration

use of org.apache.ignite.configuration.DataStorageConfiguration in project ignite by apache.

the class GridDiscoveryManager method topologySnapshotMessage.

/**
 * @param clo Wrapper of logger.
 * @param topVer Topology version.
 * @param srvNodesNum Server nodes number.
 * @param clientNodesNum Client nodes number.
 * @param totalCpus Total cpu number.
 * @param heap Heap size.
 * @param offheap Offheap size.
 */
private void topologySnapshotMessage(IgniteClosure<String, Void> clo, long topVer, int srvNodesNum, int clientNodesNum, int totalCpus, double heap, double offheap) {
    String summary = PREFIX + " [" + (discoOrdered ? "ver=" + topVer + ", " : "") + "servers=" + srvNodesNum + ", clients=" + clientNodesNum + ", CPUs=" + totalCpus + ", offheap=" + offheap + "GB" + ", heap=" + heap + "GB]";
    clo.apply(summary);
    DataStorageConfiguration memCfg = ctx.config().getDataStorageConfiguration();
    if (memCfg == null)
        return;
    clo.apply("Data Regions Configured:");
    clo.apply(dataRegionConfigurationMessage(memCfg.getDefaultDataRegionConfiguration()));
    DataRegionConfiguration[] dataRegions = memCfg.getDataRegionConfigurations();
    if (dataRegions != null) {
        for (int i = 0; i < dataRegions.length; ++i) {
            String msg = dataRegionConfigurationMessage(dataRegions[i]);
            if (msg != null)
                clo.apply(msg);
        }
    }
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration)

Example 14 with DataStorageConfiguration

use of org.apache.ignite.configuration.DataStorageConfiguration in project ignite by apache.

the class GridDiscoveryManager method requiredOffheap.

/**
 * @return Required offheap memory in bytes.
 */
private long requiredOffheap() {
    if (ctx.config().isClientMode())
        return 0;
    DataStorageConfiguration memCfg = ctx.config().getDataStorageConfiguration();
    assert memCfg != null;
    long res = memCfg.getSystemRegionMaxSize();
    // Add memory policies.
    DataRegionConfiguration[] dataRegions = memCfg.getDataRegionConfigurations();
    if (dataRegions != null) {
        for (DataRegionConfiguration dataReg : dataRegions) {
            res += dataReg.getMaxSize();
            res += GridCacheDatabaseSharedManager.checkpointBufferSize(dataReg);
        }
    }
    res += memCfg.getDefaultDataRegionConfiguration().getMaxSize();
    res += GridCacheDatabaseSharedManager.checkpointBufferSize(memCfg.getDefaultDataRegionConfiguration());
    return res;
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration)

Example 15 with DataStorageConfiguration

use of org.apache.ignite.configuration.DataStorageConfiguration in project ignite by apache.

the class CacheDataRegionConfigurationTest method testTooSmallDataRegion.

/**
 * Verifies that {@link IgniteOutOfMemoryException} is thrown when cache is configured with too small DataRegion.
 */
public void testTooSmallDataRegion() throws Exception {
    memCfg = new DataStorageConfiguration();
    DataRegionConfiguration dfltPlcCfg = new DataRegionConfiguration();
    dfltPlcCfg.setName("dfltPlc");
    dfltPlcCfg.setInitialSize(10 * 1024 * 1024);
    dfltPlcCfg.setMaxSize(10 * 1024 * 1024);
    DataRegionConfiguration bigPlcCfg = new DataRegionConfiguration();
    bigPlcCfg.setName("bigPlc");
    bigPlcCfg.setMaxSize(1024 * 1024 * 1024);
    memCfg.setDataRegionConfigurations(bigPlcCfg);
    memCfg.setDefaultDataRegionConfiguration(dfltPlcCfg);
    ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
    IgniteEx ignite0 = startGrid(0);
    IgniteCache<Object, Object> cache = ignite0.cache(DEFAULT_CACHE_NAME);
    boolean oomeThrown = false;
    try {
        for (int i = 0; i < 500_000; i++) cache.put(i, "abc");
    } catch (Exception e) {
        Throwable cause = e;
        do {
            if (cause instanceof IgniteOutOfMemoryException) {
                oomeThrown = true;
                break;
            }
            if (cause == null)
                break;
            if (cause.getSuppressed() == null || cause.getSuppressed().length == 0)
                cause = cause.getCause();
            else
                cause = cause.getSuppressed()[0];
        } while (true);
    }
    if (!oomeThrown)
        fail("OutOfMemoryException hasn't been thrown");
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) IgniteOutOfMemoryException(org.apache.ignite.internal.mem.IgniteOutOfMemoryException) IgniteEx(org.apache.ignite.internal.IgniteEx) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) IgniteOutOfMemoryException(org.apache.ignite.internal.mem.IgniteOutOfMemoryException)

Aggregations

DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)143 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)120 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)119 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)55 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)51 RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)33 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)17 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)7 File (java.io.File)6 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)6 ArrayList (java.util.ArrayList)4 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)4 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)4 TcpCommunicationSpi (org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)4 ConnectorConfiguration (org.apache.ignite.configuration.ConnectorConfiguration)3 IgniteOutOfMemoryException (org.apache.ignite.internal.mem.IgniteOutOfMemoryException)3 IOException (java.io.IOException)2 LinkedHashMap (java.util.LinkedHashMap)2 QueryEntity (org.apache.ignite.cache.QueryEntity)2 QueryIndex (org.apache.ignite.cache.QueryIndex)2