Search in sources :

Example 16 with GridMetricManager

use of org.apache.ignite.internal.processors.metric.GridMetricManager in project ignite by apache.

the class IoStatisticsCacheSelfTest method testCacheGroupCaches.

/**
 * Test statistics for two caches in the same cache group.
 */
@Test
public void testCacheGroupCaches() throws Exception {
    prepareData(RECORD_COUNT, CACHE1_IN_GROUP_NAME, CACHE2_IN_GROUP_NAME);
    GridMetricManager mmgr = ignite.context().metric();
    Set<String> statisticCacheNames = deriveStatisticNames(CACHE_GROUP);
    assertEquals(ALL_CACHE_GROUP_NAMES, statisticCacheNames);
    long logicalReads = logicalReads(mmgr, CACHE_GROUP, CACHE_GROUP_NAME);
    assertEquals(RECORD_COUNT * 4, logicalReads);
}
Also used : GridMetricManager(org.apache.ignite.internal.processors.metric.GridMetricManager) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 17 with GridMetricManager

use of org.apache.ignite.internal.processors.metric.GridMetricManager in project ignite by apache.

the class IoStatisticsCacheSelfTest method testForThreeCaches.

/**
 * Test statistics for three caches in the same time.
 */
@Test
public void testForThreeCaches() throws Exception {
    prepareData(RECORD_COUNT, ATOMIC_CACHE_NAME, TRANSACTIONAL_CACHE_NAME, MVCC_CACHE_NAME);
    GridMetricManager mmgr = ignite.context().metric();
    Set<String> statisticCacheNames = deriveStatisticNames(CACHE_GROUP);
    assertEquals(ALL_CACHE_GROUP_NAMES, statisticCacheNames);
    Stream.of(ATOMIC_CACHE_NAME, TRANSACTIONAL_CACHE_NAME, MVCC_CACHE_NAME).forEach((cacheName) -> {
        long logicalReads = logicalReads(mmgr, CACHE_GROUP, cacheName);
        assertTrue(logicalReads > RECORD_COUNT);
    });
}
Also used : GridMetricManager(org.apache.ignite.internal.processors.metric.GridMetricManager) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 18 with GridMetricManager

use of org.apache.ignite.internal.processors.metric.GridMetricManager in project ignite by apache.

the class IoStatisticsCacheSelfTest method cacheTest.

/**
 * @param cacheName Name of cache.
 * @param rowCnt Number of row need to put into cache.
 * @param dataPageReads How many data page reads operation expected.
 * @param idxPageReadsCnt How many index page reads scan expected.
 */
protected void cacheTest(String cacheName, int rowCnt, int dataPageReads, int idxPageReadsCnt) throws Exception {
    prepareData(rowCnt, cacheName);
    GridMetricManager mmgr = ignite.context().metric();
    Set<String> statisticCacheNames = deriveStatisticNames(CACHE_GROUP);
    assertEquals(ALL_CACHE_GROUP_NAMES, statisticCacheNames);
    assertTrue(statisticCacheNames.contains(cacheName));
    long logicalReadsCache = logicalReads(mmgr, CACHE_GROUP, cacheName);
    assertEquals(dataPageReads, logicalReadsCache);
    long logicalReadsIdx = logicalReads(mmgr, HASH_INDEX, metricName(cacheName, HASH_PK_IDX_NAME));
    assertEquals(idxPageReadsCnt, logicalReadsIdx);
}
Also used : GridMetricManager(org.apache.ignite.internal.processors.metric.GridMetricManager)

Example 19 with GridMetricManager

use of org.apache.ignite.internal.processors.metric.GridMetricManager in project ignite by apache.

the class GridManagerStopSelfTest method testStopCommunicationManager.

/**
 * @throws Exception If failed.
 */
@Test
public void testStopCommunicationManager() throws Exception {
    CommunicationSpi spi = new TcpCommunicationSpi();
    injectLogger(spi);
    ctx.config().setCommunicationSpi(spi);
    ctx.config().setMarshaller(new BinaryMarshaller());
    ctx.config().setMetricExporterSpi(new NoopMetricExporterSpi());
    ctx.add(new GridMetricManager(ctx));
    GridIoManager mgr = new GridIoManager(ctx);
    mgr.onKernalStop(true);
    mgr.stop(false);
}
Also used : CommunicationSpi(org.apache.ignite.spi.communication.CommunicationSpi) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) GridIoManager(org.apache.ignite.internal.managers.communication.GridIoManager) NoopMetricExporterSpi(org.apache.ignite.spi.metric.noop.NoopMetricExporterSpi) GridMetricManager(org.apache.ignite.internal.processors.metric.GridMetricManager) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 20 with GridMetricManager

use of org.apache.ignite.internal.processors.metric.GridMetricManager in project ignite by apache.

the class CacheMetricsAddRemoveTest method checkMetricsEmpty.

/**
 */
private void checkMetricsEmpty(String cachePrefix) {
    for (int i = 0; i < 3; i++) {
        GridMetricManager mmgr = metricManager(i);
        assertFalse(Iterators.tryFind(mmgr.iterator(), reg -> cachePrefix.equals(reg.name())).isPresent());
        if (nearEnabled) {
            String regName = metricName(cachePrefix, "near");
            assertFalse(Iterators.tryFind(mmgr.iterator(), reg -> regName.equals(reg.name())).isPresent());
        }
    }
}
Also used : GridMetricManager(org.apache.ignite.internal.processors.metric.GridMetricManager)

Aggregations

GridMetricManager (org.apache.ignite.internal.processors.metric.GridMetricManager)24 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)10 PerformanceStatisticsProcessor (org.apache.ignite.internal.processors.performancestatistics.PerformanceStatisticsProcessor)9 NoopMetricExporterSpi (org.apache.ignite.spi.metric.noop.NoopMetricExporterSpi)9 Test (org.junit.Test)9 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)8 DataRegionMetricsImpl (org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl)8 GridEncryptionManager (org.apache.ignite.internal.managers.encryption.GridEncryptionManager)7 GridInternalSubscriptionProcessor (org.apache.ignite.internal.processors.subscription.GridInternalSubscriptionProcessor)7 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)6 GridTestKernalContext (org.apache.ignite.testframework.junits.GridTestKernalContext)6 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)6 IgniteEx (org.apache.ignite.internal.IgniteEx)5 GridSystemViewManager (org.apache.ignite.internal.managers.systemview.GridSystemViewManager)5 JmxSystemViewExporterSpi (org.apache.ignite.internal.managers.systemview.JmxSystemViewExporterSpi)5 DirectMemoryProvider (org.apache.ignite.internal.mem.DirectMemoryProvider)5 FullPageId (org.apache.ignite.internal.pagemem.FullPageId)5 GridCacheSharedContext (org.apache.ignite.internal.processors.cache.GridCacheSharedContext)5 IgniteCacheDatabaseSharedManager (org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager)5 CheckpointProgress (org.apache.ignite.internal.processors.cache.persistence.checkpoint.CheckpointProgress)5