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