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);
}
}
}
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;
}
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);
}
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");
}
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;
}
Aggregations