use of org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl in project ignite by apache.
the class PageEvictionMetricTest method testPageEvictionMetric.
/**
* @throws Exception If failed.
*/
public void testPageEvictionMetric() throws Exception {
IgniteEx ignite = startGrid(0);
DataRegionMetricsImpl metrics = ignite.context().cache().context().database().dataRegion(null).memoryMetrics();
metrics.enableMetrics();
CacheConfiguration<Object, Object> cfg = cacheConfig("evict-metric", null, CacheMode.PARTITIONED, CacheAtomicityMode.ATOMIC, CacheWriteSynchronizationMode.PRIMARY_SYNC);
IgniteCache<Object, Object> cache = ignite.getOrCreateCache(cfg);
for (int i = 1; i <= ENTRIES; i++) {
// Row size is between PAGE_SIZE / 2 and PAGE_SIZE. Enforces "one row - one page".
cache.put(i, new TestObject(PAGE_SIZE / 6));
if (i % (ENTRIES / 10) == 0)
System.out.println(">>> Entries put: " + i);
}
assertTrue(metrics.getEvictionRate() > 0);
}
use of org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl in project ignite by apache.
the class ClusterNodeMetricsSelfTest method testAllocatedMemory.
/**
* @throws Exception If failed.
*/
public void testAllocatedMemory() throws Exception {
IgniteEx ignite = grid();
final IgniteCache cache = ignite.getOrCreateCache(CACHE_NAME);
DataRegionMetricsImpl memMetrics = getDefaultMemoryPolicyMetrics(ignite);
memMetrics.enableMetrics();
int pageSize = getPageSize(ignite);
assertEquals(0, memMetrics.getTotalAllocatedPages());
fillCache(cache);
assertTrue(memMetrics.getTotalAllocatedPages() * pageSize > MAX_VALS_AMOUNT * VAL_SIZE);
}
use of org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl in project ignite by apache.
the class BPlusTreeSelfTest method createPageMemory.
/**
* @return Page memory.
*/
protected PageMemory createPageMemory() throws Exception {
DataRegionConfiguration plcCfg = new DataRegionConfiguration().setInitialSize(1024 * MB).setMaxSize(1024 * MB);
PageMemory pageMem = new PageMemoryNoStoreImpl(log, new UnsafeMemoryProvider(log), null, PAGE_SIZE, 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 CacheFreeListImplSelfTest method createFreeList.
/**
* @param pageSize Page size.
* @return Free list.
* @throws Exception If failed.
*/
protected FreeList createFreeList(int pageSize) throws Exception {
DataRegionConfiguration plcCfg = new DataRegionConfiguration().setInitialSize(1024 * MB).setMaxSize(1024 * MB);
pageMem = createPageMemory(pageSize, plcCfg);
long metaPageId = pageMem.allocatePage(1, 1, PageIdAllocator.FLAG_DATA);
DataRegionMetricsImpl regionMetrics = new DataRegionMetricsImpl(plcCfg);
DataRegion dataRegion = new DataRegion(pageMem, plcCfg, regionMetrics, new NoOpPageEvictionTracker());
return new CacheFreeListImpl(1, "freelist", regionMetrics, dataRegion, null, null, metaPageId, true);
}
use of org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl in project ignite by apache.
the class IndexStorageSelfTest method memory.
/**
* @param clean Clean flag. If {@code true}, will clean previous memory state and allocate
* new empty page memory.
* @return Page memory instance.
*/
protected PageMemory memory(boolean clean) throws Exception {
DirectMemoryProvider provider = new MappedFileMemoryProvider(log(), allocationPath);
DataRegionConfiguration plcCfg = new DataRegionConfiguration().setMaxSize(30 * 1024 * 1024).setInitialSize(30 * 1024 * 1024);
return new PageMemoryNoStoreImpl(log, provider, null, PAGE_SIZE, plcCfg, new DataRegionMetricsImpl(plcCfg), true);
}
Aggregations