/** {@inheritDoc} */ @Override public int getInitialSize() { return (int) (dataRegCfg.getInitialSize() / (1024 * 1024)); }
/** {@inheritDoc} */ @Override public void start() throws IgniteException { long startSize = dataRegionCfg.getInitialSize(); long maxSize = dataRegionCfg.getMaxSize(); long[] chunks = new long[SEG_CNT]; chunks[0] = startSize; long total = startSize; long allocChunkSize = Math.max((maxSize - startSize) / (SEG_CNT - 1), 256L * 1024 * 1024); int lastIdx = 0; for (int i = 1; i < SEG_CNT; i++) { long allocSize = Math.min(allocChunkSize, maxSize - total); if (allocSize <= 0) break; chunks[i] = allocSize; total += allocSize; lastIdx = i; } if (lastIdx != SEG_CNT - 1) chunks = Arrays.copyOf(chunks, lastIdx + 1); if (segments == null) directMemoryProvider.initialize(chunks); addSegment(null); }
/** * @param regCfg DataRegionConfiguration to validate. * @throws IgniteCheckedException If config is invalid. */ private void checkDataRegionSize(DataRegionConfiguration regCfg) throws IgniteCheckedException { if (regCfg.getInitialSize() < MIN_PAGE_MEMORY_SIZE || regCfg.getMaxSize() < MIN_PAGE_MEMORY_SIZE) throw new IgniteCheckedException("DataRegion must have size more than 10MB (use " + "DataRegionConfiguration.initialSize and .maxSize properties to set correct size in bytes) " + "[name=" + regCfg.getName() + ", initialSize=" + U.readableSize(regCfg.getInitialSize(), true) + ", maxSize=" + U.readableSize(regCfg.getMaxSize(), true) + "]" ); if (regCfg.getMaxSize() < regCfg.getInitialSize()) { if (regCfg.getInitialSize() != Math.min(DataStorageConfiguration.DFLT_DATA_REGION_MAX_SIZE, DataStorageConfiguration.DFLT_DATA_REGION_INITIAL_SIZE)) { throw new IgniteCheckedException("DataRegion maxSize must not be smaller than initialSize" + "[name=" + regCfg.getName() + ", initialSize=" + U.readableSize(regCfg.getInitialSize(), true) + ", maxSize=" + U.readableSize(regCfg.getMaxSize(), true) + "]"); } regCfg.setInitialSize(regCfg.getMaxSize()); LT.warn(log, "DataRegion maxSize=" + U.readableSize(regCfg.getMaxSize(), true) + " is smaller than defaultInitialSize=" + U.readableSize(DataStorageConfiguration.DFLT_DATA_REGION_INITIAL_SIZE, true) + ", setting initialSize to " + U.readableSize(regCfg.getMaxSize(), true)); } if (U.jvm32Bit() && regCfg.getInitialSize() > MAX_PAGE_MEMORY_INIT_SIZE_32_BIT) throw new IgniteCheckedException("DataRegion initialSize exceeds 2GB on 32-bit JVM (use " + "DataRegionConfiguration.initialSize property to set correct size in bytes or use 64-bit JVM) " + "[name=" + regCfg.getName() + ", size=" + U.readableSize(regCfg.getInitialSize(), true) + "]"); }
/** * Constructor. * * @param plc Memory policy configuration. */ public VisorMemoryPolicyConfiguration(DataRegionConfiguration plc) { assert plc != null; name = plc.getName(); maxSize = plc.getMaxSize(); initSize = plc.getInitialSize(); swapFilePath = plc.getSwapPath(); pageEvictionMode = plc.getPageEvictionMode(); evictionThreshold = plc.getEvictionThreshold(); emptyPagesPoolSize = plc.getEmptyPagesPoolSize(); }
/** * Constructor. * * @param plc Data region configuration. */ public VisorDataRegionConfiguration(DataRegionConfiguration plc) { assert plc != null; name = plc.getName(); initSize = plc.getInitialSize(); maxSize = plc.getMaxSize(); swapPath = plc.getSwapPath(); pageEvictionMode = plc.getPageEvictionMode(); evictionThreshold = plc.getEvictionThreshold(); emptyPagesPoolSize = plc.getEmptyPagesPoolSize(); metricsEnabled = plc.isMetricsEnabled(); metricsSubIntervalCount = plc.getMetricsSubIntervalCount(); metricsRateTimeInterval = plc.getMetricsRateTimeInterval(); persistenceEnabled = plc.isPersistenceEnabled(); checkpointPageBufSize = plc.getCheckpointPageBufferSize(); }
/** * @param regCfg Data region configuration. * @return Data region message. */ private String dataRegionConfigurationMessage(DataRegionConfiguration regCfg) { if (regCfg == null) return null; SB m = new SB(); m.a(" ^-- ").a(regCfg.getName()).a(" ["); m.a("initSize=").a(U.readableSize(regCfg.getInitialSize(), false)); m.a(", maxSize=").a(U.readableSize(regCfg.getMaxSize(), false)); m.a(", persistence=" + regCfg.isPersistenceEnabled()).a(']'); return m.toString(); }
']' + U.nl() + "Out of memory in data region [" + "name=" + dataRegionCfg.getName() + ", initSize=" + U.readableSize(dataRegionCfg.getInitialSize(), false) + ", maxSize=" + U.readableSize(dataRegionCfg.getMaxSize(), false) + ", persistenceEnabled=" + dataRegionCfg.isPersistenceEnabled() + "] Try the following:" + U.nl() +
+ U.nl() + "Out of memory in data region [" + "name=" + dataRegionCfg.getName() + ", initSize=" + U.readableSize(dataRegionCfg.getInitialSize(), false) + ", maxSize=" + U.readableSize(dataRegionCfg.getMaxSize(), false) + ", persistenceEnabled=" + dataRegionCfg.isPersistenceEnabled() + "] Try the following:" + U.nl() +
/** * Writes the data region configuration. * * @param w Writer. */ private static void writeDataRegionConfiguration(BinaryRawWriter w, DataRegionConfiguration cfg) { assert w != null; assert cfg != null; w.writeString(cfg.getName()); w.writeBoolean(cfg.isPersistenceEnabled()); w.writeLong(cfg.getInitialSize()); w.writeLong(cfg.getMaxSize()); w.writeString(cfg.getSwapPath()); w.writeInt(cfg.getPageEvictionMode().ordinal()); w.writeDouble(cfg.getEvictionThreshold()); w.writeInt(cfg.getEmptyPagesPoolSize()); w.writeBoolean(cfg.isMetricsEnabled()); w.writeInt(cfg.getMetricsSubIntervalCount()); w.writeLong(cfg.getMetricsRateTimeInterval()); w.writeLong(cfg.getCheckpointPageBufferSize()); }
IgniteOutOfMemoryException oom = new IgniteOutOfMemoryException("Out of memory in data region [" + "name=" + dataRegionCfg.getName() + ", initSize=" + U.readableSize(dataRegionCfg.getInitialSize(), false) + ", maxSize=" + U.readableSize(dataRegionCfg.getMaxSize(), false) + ", persistenceEnabled=" + dataRegionCfg.isPersistenceEnabled() + "] Try the following:" + U.nl() +
", initSize=" + U.readableSize(dataRegionCfg.getInitialSize(), false) + ", maxSize=" + U.readableSize(dataRegionCfg.getMaxSize(), false) + ", persistenceEnabled=" + dataRegionCfg.isPersistenceEnabled() + "] Try the following:" + U.nl() +
/** {@inheritDoc} */ @Override public int getInitialSize() { return (int) (dataRegCfg.getInitialSize() / (1024 * 1024)); }
/** {@inheritDoc} */ @Override public void start() throws IgniteException { long startSize = dataRegionCfg.getInitialSize(); long maxSize = dataRegionCfg.getMaxSize(); long[] chunks = new long[SEG_CNT]; chunks[0] = startSize; long total = startSize; long allocChunkSize = Math.max((maxSize - startSize) / (SEG_CNT - 1), 256L * 1024 * 1024); int lastIdx = 0; for (int i = 1; i < SEG_CNT; i++) { long allocSize = Math.min(allocChunkSize, maxSize - total); if (allocSize <= 0) break; chunks[i] = allocSize; total += allocSize; lastIdx = i; } if (lastIdx != SEG_CNT - 1) chunks = Arrays.copyOf(chunks, lastIdx + 1); if (segments == null) directMemoryProvider.initialize(chunks); addSegment(null); }
/** * @param regCfg DataRegionConfiguration to validate. * @throws IgniteCheckedException If config is invalid. */ private void checkDataRegionSize(DataRegionConfiguration regCfg) throws IgniteCheckedException { if (regCfg.getInitialSize() < MIN_PAGE_MEMORY_SIZE || regCfg.getMaxSize() < MIN_PAGE_MEMORY_SIZE) throw new IgniteCheckedException("DataRegion must have size more than 10MB (use " + "DataRegionConfiguration.initialSize and .maxSize properties to set correct size in bytes) " + "[name=" + regCfg.getName() + ", initialSize=" + U.readableSize(regCfg.getInitialSize(), true) + ", maxSize=" + U.readableSize(regCfg.getMaxSize(), true) + "]" ); if (regCfg.getMaxSize() < regCfg.getInitialSize()) { if (regCfg.getInitialSize() != Math.min(DataStorageConfiguration.DFLT_DATA_REGION_MAX_SIZE, DataStorageConfiguration.DFLT_DATA_REGION_INITIAL_SIZE)) { throw new IgniteCheckedException("DataRegion maxSize must not be smaller than initialSize" + "[name=" + regCfg.getName() + ", initialSize=" + U.readableSize(regCfg.getInitialSize(), true) + ", maxSize=" + U.readableSize(regCfg.getMaxSize(), true) + "]"); } regCfg.setInitialSize(regCfg.getMaxSize()); LT.warn(log, "DataRegion maxSize=" + U.readableSize(regCfg.getMaxSize(), true) + " is smaller than defaultInitialSize=" + U.readableSize(DataStorageConfiguration.DFLT_DATA_REGION_INITIAL_SIZE, true) + ", setting initialSize to " + U.readableSize(regCfg.getMaxSize(), true)); } if (U.jvm32Bit() && regCfg.getInitialSize() > MAX_PAGE_MEMORY_INIT_SIZE_32_BIT) throw new IgniteCheckedException("DataRegion initialSize exceeds 2GB on 32-bit JVM (use " + "DataRegionConfiguration.initialSize property to set correct size in bytes or use 64-bit JVM) " + "[name=" + regCfg.getName() + ", size=" + U.readableSize(regCfg.getInitialSize(), true) + "]"); }
/** * Constructor. * * @param plc Memory policy configuration. */ public VisorMemoryPolicyConfiguration(DataRegionConfiguration plc) { assert plc != null; name = plc.getName(); maxSize = plc.getMaxSize(); initSize = plc.getInitialSize(); swapFilePath = plc.getSwapPath(); pageEvictionMode = plc.getPageEvictionMode(); evictionThreshold = plc.getEvictionThreshold(); emptyPagesPoolSize = plc.getEmptyPagesPoolSize(); }
/** * Constructor. * * @param plc Data region configuration. */ public VisorDataRegionConfiguration(DataRegionConfiguration plc) { assert plc != null; name = plc.getName(); initSize = plc.getInitialSize(); maxSize = plc.getMaxSize(); swapPath = plc.getSwapPath(); pageEvictionMode = plc.getPageEvictionMode(); evictionThreshold = plc.getEvictionThreshold(); emptyPagesPoolSize = plc.getEmptyPagesPoolSize(); metricsEnabled = plc.isMetricsEnabled(); metricsSubIntervalCount = plc.getMetricsSubIntervalCount(); metricsRateTimeInterval = plc.getMetricsRateTimeInterval(); persistenceEnabled = plc.isPersistenceEnabled(); checkpointPageBufSize = plc.getCheckpointPageBufferSize(); }
/** * @param regCfg Data region configuration. * @return Data region message. */ private String dataRegionConfigurationMessage(DataRegionConfiguration regCfg) { if (regCfg == null) return null; SB m = new SB(); m.a(" ^-- ").a(regCfg.getName()).a(" ["); m.a("initSize=").a(U.readableSize(regCfg.getInitialSize(), false)); m.a(", maxSize=").a(U.readableSize(regCfg.getMaxSize(), false)); m.a(", persistence=" + regCfg.isPersistenceEnabled()).a(']'); return m.toString(); }
']' + U.nl() + "Out of memory in data region [" + "name=" + dataRegionCfg.getName() + ", initSize=" + U.readableSize(dataRegionCfg.getInitialSize(), false) + ", maxSize=" + U.readableSize(dataRegionCfg.getMaxSize(), false) + ", persistenceEnabled=" + dataRegionCfg.isPersistenceEnabled() + "] Try the following:" + U.nl() +
/** * Writes the data region configuration. * * @param w Writer. */ private static void writeDataRegionConfiguration(BinaryRawWriter w, DataRegionConfiguration cfg) { assert w != null; assert cfg != null; w.writeString(cfg.getName()); w.writeBoolean(cfg.isPersistenceEnabled()); w.writeLong(cfg.getInitialSize()); w.writeLong(cfg.getMaxSize()); w.writeString(cfg.getSwapPath()); w.writeInt(cfg.getPageEvictionMode().ordinal()); w.writeDouble(cfg.getEvictionThreshold()); w.writeInt(cfg.getEmptyPagesPoolSize()); w.writeBoolean(cfg.isMetricsEnabled()); w.writeInt(cfg.getMetricsSubIntervalCount()); w.writeLong(cfg.getMetricsRateTimeInterval()); w.writeLong(cfg.getCheckpointPageBufferSize()); }
IgniteOutOfMemoryException oom = new IgniteOutOfMemoryException("Out of memory in data region [" + "name=" + dataRegionCfg.getName() + ", initSize=" + U.readableSize(dataRegionCfg.getInitialSize(), false) + ", maxSize=" + U.readableSize(dataRegionCfg.getMaxSize(), false) + ", persistenceEnabled=" + dataRegionCfg.isPersistenceEnabled() + "] Try the following:" + U.nl() +