Search in sources :

Example 11 with DataRegionMetricsImpl

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);
}
Also used : IgniteEx(org.apache.ignite.internal.IgniteEx) DataRegionMetricsImpl(org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl)

Example 12 with DataRegionMetricsImpl

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);
}
Also used : IgniteCache(org.apache.ignite.IgniteCache) DataRegionMetricsImpl(org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl)

Example 13 with DataRegionMetricsImpl

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;
}
Also used : DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) PageMemoryNoStoreImpl(org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl) PageMemory(org.apache.ignite.internal.pagemem.PageMemory) DataRegionMetricsImpl(org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl) UnsafeMemoryProvider(org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider)

Example 14 with DataRegionMetricsImpl

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);
}
Also used : DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) NoOpPageEvictionTracker(org.apache.ignite.internal.processors.cache.persistence.evict.NoOpPageEvictionTracker) CacheFreeListImpl(org.apache.ignite.internal.processors.cache.persistence.freelist.CacheFreeListImpl) DataRegionMetricsImpl(org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl) DataRegion(org.apache.ignite.internal.processors.cache.persistence.DataRegion)

Example 15 with DataRegionMetricsImpl

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);
}
Also used : MappedFileMemoryProvider(org.apache.ignite.internal.mem.file.MappedFileMemoryProvider) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) PageMemoryNoStoreImpl(org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl) DirectMemoryProvider(org.apache.ignite.internal.mem.DirectMemoryProvider) DataRegionMetricsImpl(org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl)

Aggregations

DataRegionMetricsImpl (org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl)19 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)15 UnsafeMemoryProvider (org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider)11 PageMemory (org.apache.ignite.internal.pagemem.PageMemory)9 DirectMemoryProvider (org.apache.ignite.internal.mem.DirectMemoryProvider)8 PageMemoryNoStoreImpl (org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl)8 GridCacheSharedContext (org.apache.ignite.internal.processors.cache.GridCacheSharedContext)6 IgniteCacheDatabaseSharedManager (org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager)6 FullPageId (org.apache.ignite.internal.pagemem.FullPageId)5 GridTestKernalContext (org.apache.ignite.testframework.junits.GridTestKernalContext)5 MappedFileMemoryProvider (org.apache.ignite.internal.mem.file.MappedFileMemoryProvider)4 File (java.io.File)2 CheckpointLockStateChecker (org.apache.ignite.internal.processors.cache.persistence.CheckpointLockStateChecker)2 Value (org.h2.value.Value)2 Comparator (java.util.Comparator)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 IgniteCache (org.apache.ignite.IgniteCache)1 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)1 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)1 GridKernalContext (org.apache.ignite.internal.GridKernalContext)1