Search in sources :

Example 11 with DataRegionConfiguration

use of org.apache.ignite.configuration.DataRegionConfiguration 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 12 with DataRegionConfiguration

use of org.apache.ignite.configuration.DataRegionConfiguration 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 13 with DataRegionConfiguration

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

the class PageMemoryNoLoadSelfTest method memory.

/**
 * @return Page memory implementation.
 * @throws Exception If failed.
 */
protected PageMemory memory() throws Exception {
    File memDir = U.resolveWorkDirectory(U.defaultWorkDirectory(), "pagemem", false);
    DataRegionConfiguration plcCfg = new DataRegionConfiguration().setMaxSize(MAX_MEMORY_SIZE).setInitialSize(MAX_MEMORY_SIZE);
    DirectMemoryProvider provider = new MappedFileMemoryProvider(log(), memDir);
    return new PageMemoryNoStoreImpl(log(), provider, null, PAGE_SIZE, plcCfg, new DataRegionMetricsImpl(plcCfg), true);
}
Also used : MappedFileMemoryProvider(org.apache.ignite.internal.mem.file.MappedFileMemoryProvider) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) DirectMemoryProvider(org.apache.ignite.internal.mem.DirectMemoryProvider) DataRegionMetricsImpl(org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl) File(java.io.File)

Example 14 with DataRegionConfiguration

use of org.apache.ignite.configuration.DataRegionConfiguration 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)

Example 15 with DataRegionConfiguration

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

the class AuthenticationConfigurationClusterTest method configuration.

/**
 * @param idx Node index.
 * @param authEnabled Authentication enabled.
 * @param client Client node flag.
 * @return Ignite configuration.
 * @throws Exception On error.
 */
private IgniteConfiguration configuration(int idx, boolean authEnabled, boolean client) throws Exception {
    IgniteConfiguration cfg = getConfiguration(getTestIgniteInstanceName(idx));
    cfg.setClientMode(client);
    TcpDiscoverySpi spi = new TcpDiscoverySpi();
    spi.setIpFinder(IP_FINDER);
    cfg.setDiscoverySpi(spi);
    cfg.setAuthenticationEnabled(authEnabled);
    cfg.setDataStorageConfiguration(new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true)));
    return cfg;
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Aggregations

DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)147 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)119 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)108 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)48 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)45 RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)33 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)16 DataRegionMetricsImpl (org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl)15 UnsafeMemoryProvider (org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider)10 PageMemory (org.apache.ignite.internal.pagemem.PageMemory)9 DirectMemoryProvider (org.apache.ignite.internal.mem.DirectMemoryProvider)8 File (java.io.File)7 PageMemoryNoStoreImpl (org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl)7 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)5 MappedFileMemoryProvider (org.apache.ignite.internal.mem.file.MappedFileMemoryProvider)5 FullPageId (org.apache.ignite.internal.pagemem.FullPageId)5 GridCacheSharedContext (org.apache.ignite.internal.processors.cache.GridCacheSharedContext)5 IgniteCacheDatabaseSharedManager (org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager)5 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)4 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)4