Search in sources :

Example 16 with HistogramMetricImpl

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

the class GridCacheAbstractMetricsSelfTest method testPutTime.

/**
 */
@Test
public void testPutTime() throws Exception {
    IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
    HistogramMetricImpl putTime = metric("PutTime");
    HistogramMetricImpl putAllTime = metric("PutAllTime");
    assertTrue(stream(putTime.value()).allMatch(v -> v == 0));
    assertTrue(stream(putAllTime.value()).allMatch(v -> v == 0));
    cache.put(1, 1);
    cache.putAsync(2, 2).get();
    assertTrue(waitForCondition(() -> stream(putTime.value()).sum() == 2, getTestTimeout()));
    assertEquals(0, stream(putAllTime.value()).sum());
    cache.putAll(F.asMap(3, 3));
    cache.putAllAsync(F.asMap(4, 4)).get();
    assertTrue(waitForCondition(() -> stream(putAllTime.value()).sum() == 2, getTestTimeout()));
    assertEquals(2, stream(putTime.value()).sum());
}
Also used : CacheAtomicityMode(org.apache.ignite.cache.CacheAtomicityMode) GridAbsPredicateX(org.apache.ignite.internal.util.lang.GridAbsPredicateX) TouchedExpiryPolicy(javax.cache.expiry.TouchedExpiryPolicy) Metric(org.apache.ignite.spi.metric.Metric) EntryProcessorResult(javax.cache.processor.EntryProcessorResult) Transaction(org.apache.ignite.transactions.Transaction) GridTestUtils.waitForCondition(org.apache.ignite.testframework.GridTestUtils.waitForCondition) U(org.apache.ignite.internal.util.typedef.internal.U) HashMap(java.util.HashMap) IgniteEx(org.apache.ignite.internal.IgniteEx) EntryProcessorException(javax.cache.processor.EntryProcessorException) TreeSet(java.util.TreeSet) MutableEntry(javax.cache.processor.MutableEntry) MetricUtils.cacheMetricsRegistryName(org.apache.ignite.internal.processors.metric.impl.MetricUtils.cacheMetricsRegistryName) Collections.singleton(java.util.Collections.singleton) Map(java.util.Map) Duration(javax.cache.expiry.Duration) LinkedHashSet(java.util.LinkedHashSet) IgniteKernal(org.apache.ignite.internal.IgniteKernal) F(org.apache.ignite.internal.util.typedef.F) IgniteFuture(org.apache.ignite.lang.IgniteFuture) ExpiryPolicy(javax.cache.expiry.ExpiryPolicy) CachePeekMode(org.apache.ignite.cache.CachePeekMode) ImmutableMap(com.google.common.collect.ImmutableMap) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) Set(java.util.Set) Test(org.junit.Test) Ignite(org.apache.ignite.Ignite) MILLISECONDS(java.util.concurrent.TimeUnit.MILLISECONDS) MetricRegistry(org.apache.ignite.internal.processors.metric.MetricRegistry) IgniteCache(org.apache.ignite.IgniteCache) TimeUnit(java.util.concurrent.TimeUnit) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) HistogramMetricImpl(org.apache.ignite.internal.processors.metric.impl.HistogramMetricImpl) CacheEntryProcessor(org.apache.ignite.cache.CacheEntryProcessor) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) CacheMetrics(org.apache.ignite.cache.CacheMetrics) LongMetric(org.apache.ignite.spi.metric.LongMetric) Arrays.stream(java.util.Arrays.stream) CacheMode(org.apache.ignite.cache.CacheMode) HistogramMetricImpl(org.apache.ignite.internal.processors.metric.impl.HistogramMetricImpl) Test(org.junit.Test)

Example 17 with HistogramMetricImpl

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

the class GridCacheAbstractMetricsSelfTest method testGetAllOutTx.

/**
 */
@Test
public void testGetAllOutTx() throws Exception {
    IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
    HistogramMetricImpl getAllTime = metric("GetAllTime");
    assertTrue(stream(getAllTime.value()).allMatch(v -> v == 0));
    cache.getAllOutTx(singleton(1));
    assertTrue(waitForCondition(() -> stream(getAllTime.value()).sum() == 1, getTestTimeout()));
    cache.getAllOutTxAsync(singleton(1)).get();
    assertTrue(waitForCondition(() -> stream(getAllTime.value()).sum() == 2, getTestTimeout()));
}
Also used : CacheAtomicityMode(org.apache.ignite.cache.CacheAtomicityMode) GridAbsPredicateX(org.apache.ignite.internal.util.lang.GridAbsPredicateX) TouchedExpiryPolicy(javax.cache.expiry.TouchedExpiryPolicy) Metric(org.apache.ignite.spi.metric.Metric) EntryProcessorResult(javax.cache.processor.EntryProcessorResult) Transaction(org.apache.ignite.transactions.Transaction) GridTestUtils.waitForCondition(org.apache.ignite.testframework.GridTestUtils.waitForCondition) U(org.apache.ignite.internal.util.typedef.internal.U) HashMap(java.util.HashMap) IgniteEx(org.apache.ignite.internal.IgniteEx) EntryProcessorException(javax.cache.processor.EntryProcessorException) TreeSet(java.util.TreeSet) MutableEntry(javax.cache.processor.MutableEntry) MetricUtils.cacheMetricsRegistryName(org.apache.ignite.internal.processors.metric.impl.MetricUtils.cacheMetricsRegistryName) Collections.singleton(java.util.Collections.singleton) Map(java.util.Map) Duration(javax.cache.expiry.Duration) LinkedHashSet(java.util.LinkedHashSet) IgniteKernal(org.apache.ignite.internal.IgniteKernal) F(org.apache.ignite.internal.util.typedef.F) IgniteFuture(org.apache.ignite.lang.IgniteFuture) ExpiryPolicy(javax.cache.expiry.ExpiryPolicy) CachePeekMode(org.apache.ignite.cache.CachePeekMode) ImmutableMap(com.google.common.collect.ImmutableMap) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) Set(java.util.Set) Test(org.junit.Test) Ignite(org.apache.ignite.Ignite) MILLISECONDS(java.util.concurrent.TimeUnit.MILLISECONDS) MetricRegistry(org.apache.ignite.internal.processors.metric.MetricRegistry) IgniteCache(org.apache.ignite.IgniteCache) TimeUnit(java.util.concurrent.TimeUnit) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) HistogramMetricImpl(org.apache.ignite.internal.processors.metric.impl.HistogramMetricImpl) CacheEntryProcessor(org.apache.ignite.cache.CacheEntryProcessor) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) CacheMetrics(org.apache.ignite.cache.CacheMetrics) LongMetric(org.apache.ignite.spi.metric.LongMetric) Arrays.stream(java.util.Arrays.stream) CacheMode(org.apache.ignite.cache.CacheMode) HistogramMetricImpl(org.apache.ignite.internal.processors.metric.impl.HistogramMetricImpl) Test(org.junit.Test)

Example 18 with HistogramMetricImpl

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

the class GridCacheAbstractMetricsSelfTest method testGetTime.

/**
 */
@Test
public void testGetTime() throws Exception {
    IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
    HistogramMetricImpl getTime = metric("GetTime");
    HistogramMetricImpl getAllTime = metric("GetAllTime");
    assertTrue(stream(getTime.value()).allMatch(v -> v == 0));
    assertTrue(stream(getAllTime.value()).allMatch(v -> v == 0));
    cache.get(1);
    cache.getAsync(1).get();
    assertTrue(waitForCondition(() -> stream(getTime.value()).sum() == 2, getTestTimeout()));
    assertEquals(0, stream(getAllTime.value()).sum());
    cache.getAll(singleton(1));
    cache.getAllAsync(singleton(1)).get();
    assertTrue(waitForCondition(() -> stream(getAllTime.value()).sum() == 2, getTestTimeout()));
    assertEquals(2, stream(getTime.value()).sum());
}
Also used : CacheAtomicityMode(org.apache.ignite.cache.CacheAtomicityMode) GridAbsPredicateX(org.apache.ignite.internal.util.lang.GridAbsPredicateX) TouchedExpiryPolicy(javax.cache.expiry.TouchedExpiryPolicy) Metric(org.apache.ignite.spi.metric.Metric) EntryProcessorResult(javax.cache.processor.EntryProcessorResult) Transaction(org.apache.ignite.transactions.Transaction) GridTestUtils.waitForCondition(org.apache.ignite.testframework.GridTestUtils.waitForCondition) U(org.apache.ignite.internal.util.typedef.internal.U) HashMap(java.util.HashMap) IgniteEx(org.apache.ignite.internal.IgniteEx) EntryProcessorException(javax.cache.processor.EntryProcessorException) TreeSet(java.util.TreeSet) MutableEntry(javax.cache.processor.MutableEntry) MetricUtils.cacheMetricsRegistryName(org.apache.ignite.internal.processors.metric.impl.MetricUtils.cacheMetricsRegistryName) Collections.singleton(java.util.Collections.singleton) Map(java.util.Map) Duration(javax.cache.expiry.Duration) LinkedHashSet(java.util.LinkedHashSet) IgniteKernal(org.apache.ignite.internal.IgniteKernal) F(org.apache.ignite.internal.util.typedef.F) IgniteFuture(org.apache.ignite.lang.IgniteFuture) ExpiryPolicy(javax.cache.expiry.ExpiryPolicy) CachePeekMode(org.apache.ignite.cache.CachePeekMode) ImmutableMap(com.google.common.collect.ImmutableMap) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) Set(java.util.Set) Test(org.junit.Test) Ignite(org.apache.ignite.Ignite) MILLISECONDS(java.util.concurrent.TimeUnit.MILLISECONDS) MetricRegistry(org.apache.ignite.internal.processors.metric.MetricRegistry) IgniteCache(org.apache.ignite.IgniteCache) TimeUnit(java.util.concurrent.TimeUnit) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) HistogramMetricImpl(org.apache.ignite.internal.processors.metric.impl.HistogramMetricImpl) CacheEntryProcessor(org.apache.ignite.cache.CacheEntryProcessor) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) CacheMetrics(org.apache.ignite.cache.CacheMetrics) LongMetric(org.apache.ignite.spi.metric.LongMetric) Arrays.stream(java.util.Arrays.stream) CacheMode(org.apache.ignite.cache.CacheMode) HistogramMetricImpl(org.apache.ignite.internal.processors.metric.impl.HistogramMetricImpl) Test(org.junit.Test)

Aggregations

HistogramMetricImpl (org.apache.ignite.internal.processors.metric.impl.HistogramMetricImpl)18 Test (org.junit.Test)13 MetricRegistry (org.apache.ignite.internal.processors.metric.MetricRegistry)7 IgniteCache (org.apache.ignite.IgniteCache)6 CacheMetrics (org.apache.ignite.cache.CacheMetrics)6 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)6 U (org.apache.ignite.internal.util.typedef.internal.U)6 Transaction (org.apache.ignite.transactions.Transaction)6 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)5 IgniteEx (org.apache.ignite.internal.IgniteEx)5 LongMetric (org.apache.ignite.spi.metric.LongMetric)5 ImmutableMap (com.google.common.collect.ImmutableMap)4 Arrays.stream (java.util.Arrays.stream)4 Collections.singleton (java.util.Collections.singleton)4 HashMap (java.util.HashMap)4 LinkedHashSet (java.util.LinkedHashSet)4 Map (java.util.Map)4 Set (java.util.Set)4 TreeSet (java.util.TreeSet)4 TimeUnit (java.util.concurrent.TimeUnit)4