use of org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl in project ignite by apache.
the class PageMemoryImplNoLoadTest method memory.
/**
* @return Page memory implementation.
*/
@Override
protected PageMemory memory() throws Exception {
File memDir = U.resolveWorkDirectory(U.defaultWorkDirectory(), "pagemem", false);
long[] sizes = new long[10];
for (int i = 0; i < sizes.length; i++) sizes[i] = 5 * 1024 * 1024;
DirectMemoryProvider provider = new MappedFileMemoryProvider(log(), memDir);
GridCacheSharedContext<Object, Object> sharedCtx = new GridCacheSharedContext<>(new GridTestKernalContext(log), null, null, null, new NoOpPageStoreManager(), new NoOpWALManager(), null, new IgniteCacheDatabaseSharedManager(), null, null, null, null, null, null, null, null);
return new PageMemoryImpl(provider, sizes, sharedCtx, PAGE_SIZE, (fullPageId, byteBuf, tag) -> {
assert false : "No page replacement (rotation with disk) should happen during the test";
}, new GridInClosure3X<Long, FullPageId, PageMemoryEx>() {
@Override
public void applyx(Long page, FullPageId fullId, PageMemoryEx pageMem) {
}
}, new CheckpointLockStateChecker() {
@Override
public boolean checkpointLockIsHeldByThread() {
return true;
}
}, new DataRegionMetricsImpl(new DataRegionConfiguration()), PageMemoryImpl.ThrottlingPolicy.DISABLED, null);
}
use of org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl in project ignite by apache.
the class CacheFreeListImplSelfTest method createPageMemory.
/**
* @return Page memory.
*/
protected PageMemory createPageMemory(int pageSize, DataRegionConfiguration plcCfg) throws Exception {
PageMemory pageMem = new PageMemoryNoStoreImpl(log, new UnsafeMemoryProvider(log), null, pageSize, plcCfg, new DataRegionMetricsImpl(plcCfg), true);
pageMem.start();
return pageMem;
}
use of org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl in project ignite by apache.
the class DataRegionMetricsSelfTest method beforeTest.
/**
* {@inheritDoc}
*/
@Override
protected void beforeTest() throws Exception {
DataRegionConfiguration plcCfg = new DataRegionConfiguration();
memMetrics = new DataRegionMetricsImpl(plcCfg);
memMetrics.enableMetrics();
}
use of org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl in project ignite by apache.
the class BPlusTreeBenchmark method createPageMemory.
/**
* @return Page memory.
* @throws Exception If failed.
*/
private PageMemory createPageMemory() throws Exception {
long[] sizes = new long[CPUS];
for (int i = 0; i < sizes.length; i++) sizes[i] = 1024 * MB / CPUS;
DataRegionConfiguration plcCfg = new DataRegionConfiguration().setMaxSize(1024 * MB);
PageMemory pageMem = new PageMemoryNoStoreImpl(new JavaLogger(), new UnsafeMemoryProvider(new JavaLogger()), null, PAGE_SIZE, plcCfg, new DataRegionMetricsImpl(plcCfg), false);
pageMem.start();
return pageMem;
}
use of org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl in project ignite by apache.
the class PageMemoryImplTest method createPageMemory.
/**
* @param throttlingPlc Throttling Policy.
* @throws Exception If creating mock failed.
*/
private PageMemoryImpl createPageMemory(PageMemoryImpl.ThrottlingPolicy throttlingPlc) throws Exception {
long[] sizes = new long[5];
for (int i = 0; i < sizes.length; i++) sizes[i] = MAX_SIZE * MB / 4;
sizes[4] = 5 * MB;
DirectMemoryProvider provider = new UnsafeMemoryProvider(log);
IgniteConfiguration igniteCfg = new IgniteConfiguration();
igniteCfg.setDataStorageConfiguration(new DataStorageConfiguration());
GridTestKernalContext kernalCtx = new GridTestKernalContext(new GridTestLog4jLogger(), igniteCfg);
kernalCtx.add(new IgnitePluginProcessor(kernalCtx, igniteCfg, Collections.<PluginProvider>emptyList()));
GridCacheSharedContext<Object, Object> sharedCtx = new GridCacheSharedContext<>(kernalCtx, null, null, null, new NoOpPageStoreManager(), new NoOpWALManager(), null, new IgniteCacheDatabaseSharedManager(), null, null, null, null, null, null, null, null);
CheckpointWriteProgressSupplier noThrottle = Mockito.mock(CheckpointWriteProgressSupplier.class);
Mockito.when(noThrottle.currentCheckpointPagesCount()).thenReturn(1_000_000);
Mockito.when(noThrottle.evictedPagesCntr()).thenReturn(new AtomicInteger(0));
Mockito.when(noThrottle.syncedPagesCounter()).thenReturn(new AtomicInteger(1_000_000));
Mockito.when(noThrottle.writtenPagesCounter()).thenReturn(new AtomicInteger(1_000_000));
PageMemoryImpl mem = new PageMemoryImpl(provider, sizes, sharedCtx, PAGE_SIZE, (fullPageId, byteBuf, tag) -> {
assert false : "No page replacement (rotation with disk) should happen during the test";
}, new GridInClosure3X<Long, FullPageId, PageMemoryEx>() {
@Override
public void applyx(Long page, FullPageId fullId, PageMemoryEx pageMem) {
}
}, new CheckpointLockStateChecker() {
@Override
public boolean checkpointLockIsHeldByThread() {
return true;
}
}, new DataRegionMetricsImpl(igniteCfg.getDataStorageConfiguration().getDefaultDataRegionConfiguration()), throttlingPlc, noThrottle);
mem.start();
return mem;
}
Aggregations