Search in sources :

Example 21 with LocalMapStats

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

the class ClientMapTest method testMapSetAsyncStatistics.

@Test
public void testMapSetAsyncStatistics() {
    final String name = randomString();
    IMap<Integer, Integer> map = client.getMap(name);
    final int operationCount = 127;
    for (int i = 0; i < operationCount; i++) {
        map.setAsync(i, i);
        map.remove(i);
    }
    assertTrueEventually(() -> {
        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 22 with LocalMapStats

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

the class ClientMapTest method testMapSetAsyncWithTtlAndMaxIdleStatistics.

@Test
public void testMapSetAsyncWithTtlAndMaxIdleStatistics() {
    final String name = randomString();
    IMap<Integer, Integer> map = client.getMap(name);
    final int operationCount = 467;
    for (int i = 0; i < operationCount; i++) {
        map.setAsync(i, i, 1, TimeUnit.MINUTES, 1, TimeUnit.MINUTES);
        map.remove(i);
    }
    assertTrueEventually(() -> {
        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 23 with LocalMapStats

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

the class ClientMultiMapStatsTest method testPutAllAndHitsGeneratedTemplateVerify.

@Override
public void testPutAllAndHitsGeneratedTemplateVerify() {
    LocalMapStats localMapStats1 = getMultiMapStats();
    LocalMapStats localMapStats2 = getMultiMapStats(mapNameSet);
    assertEquals(300, localMapStats1.getOwnedEntryCount());
    assertEquals(100, localMapStats1.getHits());
    assertEquals(100, localMapStats2.getOwnedEntryCount());
    assertEquals(100, localMapStats2.getHits());
}
Also used : LocalMapStats(com.hazelcast.map.LocalMapStats)

Example 24 with LocalMapStats

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

the class NearCacheTest method testNullValueNearCache.

// issue 1570
@Test
public void testNullValueNearCache() {
    int clusterSize = 2;
    String mapName = "testNullValueNearCache";
    Config config = getConfig();
    config.getMapConfig(mapName).setNearCacheConfig(newNearCacheConfig());
    HazelcastInstance instance = createHazelcastInstanceFactory(clusterSize).newInstances(config)[0];
    IMap<String, String> map = instance.getMap(mapName);
    for (int i = 0; i < MAX_CACHE_SIZE; i++) {
        assertNull(map.get("key" + i));
    }
    for (int i = 0; i < MAX_CACHE_SIZE; i++) {
        assertNull(map.get("key" + i));
    }
    LocalMapStats stats = map.getLocalMapStats();
    assertTrue(format("Near Cache operation count should be < %d but was %d", MAX_CACHE_SIZE * 2, stats.getGetOperationCount()), stats.getGetOperationCount() < MAX_CACHE_SIZE * 2);
}
Also used : LocalMapStats(com.hazelcast.map.LocalMapStats) HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapConfig(com.hazelcast.config.MapConfig) Config(com.hazelcast.config.Config) NearCacheConfig(com.hazelcast.config.NearCacheConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 25 with LocalMapStats

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

the class MapCreationDelayWithMapStoreTest method testMapCreation__notAffectedByUnresponsiveLoader.

@Test(timeout = 120000)
public void testMapCreation__notAffectedByUnresponsiveLoader() {
    final UnresponsiveLoader<Integer, Integer> unresponsiveLoader = new UnresponsiveLoader<Integer, Integer>();
    final IMap<Integer, Integer> map = TestMapUsingMapStoreBuilder.<Integer, Integer>create().withMapStore(unresponsiveLoader).withNodeCount(1).withNodeFactory(createHazelcastInstanceFactory(1)).withPartitionCount(1).build();
    final LocalMapStats stats = map.getLocalMapStats();
    final long ownedEntryCount = stats.getOwnedEntryCount();
    assertEquals(0, ownedEntryCount);
}
Also used : LocalMapStats(com.hazelcast.map.LocalMapStats) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

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