Search in sources :

Example 11 with LocalMapStats

use of com.hazelcast.map.LocalMapStats in project hazelcast by hazelcast.

the class LocalMultiMapStatsTest method testOtherOperationCount_size.

@Test
public void testOtherOperationCount_size() {
    MultiMap map = getMultiMap();
    for (int i = 0; i < OPERATION_COUNT; i++) {
        map.size();
    }
    LocalMapStats stats = getMultiMapStats();
    assertEquals(OPERATION_COUNT, stats.getOtherOperationCount());
}
Also used : LocalMapStats(com.hazelcast.map.LocalMapStats) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 12 with LocalMapStats

use of com.hazelcast.map.LocalMapStats in project hazelcast by hazelcast.

the class MapStoreTest method issue614.

@Test(timeout = 120000)
public void issue614() {
    final ConcurrentMap<Long, String> STORE = new ConcurrentHashMap<>();
    STORE.put(1L, "Event1");
    STORE.put(2L, "Event2");
    STORE.put(3L, "Event3");
    STORE.put(4L, "Event4");
    STORE.put(5L, "Event5");
    STORE.put(6L, "Event6");
    Config config = getConfig();
    config.getMapConfig("map").setMapStoreConfig(new MapStoreConfig().setWriteDelaySeconds(1).setImplementation(new SimpleMapStore<>(STORE)));
    TestHazelcastInstanceFactory nodeFactory = createHazelcastInstanceFactory(3);
    HazelcastInstance instance = nodeFactory.newHazelcastInstance(config);
    IMap map = instance.getMap("map");
    map.values();
    LocalMapStats localMapStats = map.getLocalMapStats();
    assertEquals(0, localMapStats.getDirtyEntryCount());
}
Also used : LocalMapStats(com.hazelcast.map.LocalMapStats) IMap(com.hazelcast.map.IMap) HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapConfig(com.hazelcast.config.MapConfig) MapStoreConfig(com.hazelcast.config.MapStoreConfig) Config(com.hazelcast.config.Config) AtomicLong(java.util.concurrent.atomic.AtomicLong) MapStoreConfig(com.hazelcast.config.MapStoreConfig) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 13 with LocalMapStats

use of com.hazelcast.map.LocalMapStats in project hazelcast by hazelcast.

the class ClientMapTest method testMapSetWithTtlAndMaxIdleStatistics.

@Test
public void testMapSetWithTtlAndMaxIdleStatistics() {
    String name = randomString();
    IMap<Integer, Integer> map = client.getMap(name);
    int operationCount = 467;
    for (int i = 0; i < operationCount; i++) {
        map.set(i, i, 1, TimeUnit.MINUTES, 1, TimeUnit.MINUTES);
        map.remove(i);
    }
    LocalMapStats localMapStats = server.getMap(name).getLocalMapStats();
    assertEquals("put count", 0, localMapStats.getPutOperationCount());
    assertEquals("set count", operationCount, localMapStats.getSetOperationCount());
    assertEquals("get count", 0, localMapStats.getGetOperationCount());
    assertEquals("remove count", operationCount, localMapStats.getRemoveOperationCount());
    assertTrue("set latency", localMapStats.getTotalSetLatency() > 0);
    assertTrue("max set latency", localMapStats.getMaxSetLatency() > 0);
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) LocalMapStats(com.hazelcast.map.LocalMapStats) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 14 with LocalMapStats

use of com.hazelcast.map.LocalMapStats in project hazelcast by hazelcast.

the class ClientMapTest method testMapSetWithTtlStatistics.

@Test
public void testMapSetWithTtlStatistics() {
    String name = randomString();
    IMap<Integer, Integer> map = client.getMap(name);
    int operationCount = 1000;
    for (int i = 0; i < operationCount; i++) {
        map.set(i, i, 1, TimeUnit.MINUTES);
        map.remove(i);
    }
    LocalMapStats localMapStats = server.getMap(name).getLocalMapStats();
    assertEquals("put count", 0, localMapStats.getPutOperationCount());
    assertEquals("set count", operationCount, localMapStats.getSetOperationCount());
    assertEquals("get count", 0, localMapStats.getGetOperationCount());
    assertEquals("remove count", operationCount, localMapStats.getRemoveOperationCount());
    assertTrue("set latency", localMapStats.getTotalSetLatency() > 0);
    assertTrue("max set latency", localMapStats.getMaxSetLatency() > 0);
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) LocalMapStats(com.hazelcast.map.LocalMapStats) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 15 with LocalMapStats

use of com.hazelcast.map.LocalMapStats in project Payara by payara.

the class ClusteredStore method collect.

@Override
public void collect(MonitoringDataCollector collector) {
    if (hzCore.isEnabled()) {
        try (Context ctx = ctxUtil.empty().pushContext()) {
            HazelcastInstance hz = hzCore.getInstance();
            for (DistributedObject obj : hz.getDistributedObjects()) {
                if (MapService.SERVICE_NAME.equals(obj.getServiceName())) {
                    MapConfig config = hz.getConfig().getMapConfig(obj.getName());
                    if (config.isStatisticsEnabled()) {
                        IMap<Object, Object> map = hz.getMap(obj.getName());
                        if (map != null) {
                            LocalMapStats stats = map.getLocalMapStats();
                            collector.in("map").group(map.getName()).collect("GetCount", stats.getGetOperationCount()).collect("PutCount", stats.getPutOperationCount()).collect("EntryCount", stats.getOwnedEntryCount());
                        }
                    }
                }
            }
        }
    }
}
Also used : Context(org.glassfish.internal.api.JavaEEContextUtil.Context) LocalMapStats(com.hazelcast.map.LocalMapStats) DistributedObject(com.hazelcast.core.DistributedObject) HazelcastInstance(com.hazelcast.core.HazelcastInstance) DistributedObject(com.hazelcast.core.DistributedObject) MapConfig(com.hazelcast.config.MapConfig)

Aggregations

LocalMapStats (com.hazelcast.map.LocalMapStats)34 QuickTest (com.hazelcast.test.annotation.QuickTest)29 Test (org.junit.Test)29 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)28 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)6 MapConfig (com.hazelcast.config.MapConfig)3 HazelcastInstance (com.hazelcast.core.HazelcastInstance)3 IMap (com.hazelcast.map.IMap)3 Config (com.hazelcast.config.Config)2 LocalIndexStats (com.hazelcast.query.LocalIndexStats)2 Map (java.util.Map)2 MapStoreConfig (com.hazelcast.config.MapStoreConfig)1 NearCacheConfig (com.hazelcast.config.NearCacheConfig)1 DistributedObject (com.hazelcast.core.DistributedObject)1 MetricDescriptor (com.hazelcast.internal.metrics.MetricDescriptor)1 LocalIndexStatsImpl (com.hazelcast.internal.monitor.impl.LocalIndexStatsImpl)1 LocalMapStatsImpl (com.hazelcast.internal.monitor.impl.LocalMapStatsImpl)1 PerIndexStats (com.hazelcast.internal.monitor.impl.PerIndexStats)1 StatisticsAwareService (com.hazelcast.internal.services.StatisticsAwareService)1 BasicMapTest (com.hazelcast.map.BasicMapTest)1