/** * 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(); }
/** * @param regCfg DataRegionConfiguration to validate. * @param dbCfg Memory configuration. * @throws IgniteCheckedException If config is invalid. */ protected void checkRegionEvictionProperties(DataRegionConfiguration regCfg, DataStorageConfiguration dbCfg) throws IgniteCheckedException { if (regCfg.getPageEvictionMode() == DataPageEvictionMode.DISABLED) return; if (regCfg.getEvictionThreshold() < 0.5 || regCfg.getEvictionThreshold() > 0.999) { throw new IgniteCheckedException("Page eviction threshold must be between 0.5 and 0.999: " + regCfg.getName()); } if (regCfg.getEmptyPagesPoolSize() <= 10) throw new IgniteCheckedException("Evicted pages pool size should be greater than 10: " + regCfg.getName()); long maxPoolSize = regCfg.getMaxSize() / dbCfg.getPageSize() / 10; if (regCfg.getEmptyPagesPoolSize() >= maxPoolSize) { throw new IgniteCheckedException("Evicted pages pool size should be lesser than " + maxPoolSize + ": " + regCfg.getName()); } }
/** * 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(); }
/** * See {@link GridCacheMapEntry#ensureFreeSpace()} * * @param memPlc data region. */ public void ensureFreeSpace(DataRegion memPlc) throws IgniteCheckedException { if (memPlc == null) return; DataRegionConfiguration plcCfg = memPlc.config(); if (plcCfg.getPageEvictionMode() == DataPageEvictionMode.DISABLED || plcCfg.isPersistenceEnabled()) return; long memorySize = plcCfg.getMaxSize(); PageMemory pageMem = memPlc.pageMemory(); int sysPageSize = pageMem.systemPageSize(); CacheFreeListImpl freeListImpl = freeListMap.get(plcCfg.getName()); for (;;) { long allocatedPagesCnt = pageMem.loadedPages(); int emptyDataPagesCnt = freeListImpl.emptyDataPages(); boolean shouldEvict = allocatedPagesCnt > (memorySize / sysPageSize * plcCfg.getEvictionThreshold()) && emptyDataPagesCnt < plcCfg.getEmptyPagesPoolSize(); if (shouldEvict) { warnFirstEvict(plcCfg); memPlc.evictionTracker().evictDataPage(); memPlc.memoryMetrics().updateEvictionRate(); } else break; } }
/** * 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()); }
/** * 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(); }
/** * @param regCfg DataRegionConfiguration to validate. * @param dbCfg Memory configuration. * @throws IgniteCheckedException If config is invalid. */ protected void checkRegionEvictionProperties(DataRegionConfiguration regCfg, DataStorageConfiguration dbCfg) throws IgniteCheckedException { if (regCfg.getPageEvictionMode() == DataPageEvictionMode.DISABLED) return; if (regCfg.getEvictionThreshold() < 0.5 || regCfg.getEvictionThreshold() > 0.999) { throw new IgniteCheckedException("Page eviction threshold must be between 0.5 and 0.999: " + regCfg.getName()); } if (regCfg.getEmptyPagesPoolSize() <= 10) throw new IgniteCheckedException("Evicted pages pool size should be greater than 10: " + regCfg.getName()); long maxPoolSize = regCfg.getMaxSize() / dbCfg.getPageSize() / 10; if (regCfg.getEmptyPagesPoolSize() >= maxPoolSize) { throw new IgniteCheckedException("Evicted pages pool size should be lesser than " + maxPoolSize + ": " + regCfg.getName()); } }
/** * 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(); }
/** * See {@link GridCacheMapEntry#ensureFreeSpace()} * * @param memPlc data region. */ public void ensureFreeSpace(DataRegion memPlc) throws IgniteCheckedException { if (memPlc == null) return; DataRegionConfiguration plcCfg = memPlc.config(); if (plcCfg.getPageEvictionMode() == DataPageEvictionMode.DISABLED || plcCfg.isPersistenceEnabled()) return; long memorySize = plcCfg.getMaxSize(); PageMemory pageMem = memPlc.pageMemory(); int sysPageSize = pageMem.systemPageSize(); CacheFreeListImpl freeListImpl = freeListMap.get(plcCfg.getName()); for (;;) { long allocatedPagesCnt = pageMem.loadedPages(); int emptyDataPagesCnt = freeListImpl.emptyDataPages(); boolean shouldEvict = allocatedPagesCnt > (memorySize / sysPageSize * plcCfg.getEvictionThreshold()) && emptyDataPagesCnt < plcCfg.getEmptyPagesPoolSize(); if (shouldEvict) { warnFirstEvict(plcCfg); memPlc.evictionTracker().evictDataPage(); memPlc.memoryMetrics().updateEvictionRate(); } else break; } }
/** * 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()); }