use of com.hazelcast.monitor.LocalMapStats in project hazelcast by hazelcast.
the class LocalMapStatsTest method testGetAsyncAndHitsGenerated.
@Test
public void testGetAsyncAndHitsGenerated() throws Exception {
final IMap<Integer, Integer> map = getMap();
for (int i = 0; i < 100; i++) {
map.put(i, i);
map.getAsync(i).get();
}
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
final LocalMapStats localMapStats = map.getLocalMapStats();
assertEquals(100, localMapStats.getGetOperationCount());
assertEquals(100, localMapStats.getHits());
}
});
}
use of com.hazelcast.monitor.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);
}
use of com.hazelcast.monitor.LocalMapStats in project hazelcast by hazelcast.
the class MapCreationDelayWithMapStoreTest method testMapCreation__notAffectedByUnresponsiveLoader.
@Test(timeout = 120000)
public void testMapCreation__notAffectedByUnresponsiveLoader() throws Exception {
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);
}
use of com.hazelcast.monitor.LocalMapStats in project hazelcast by hazelcast.
the class ClientMapBasicTest method testMapStatistics_withClientOperations.
@Test
public void testMapStatistics_withClientOperations() {
String mapName = randomString();
LocalMapStats stats1 = member1.getMap(mapName).getLocalMapStats();
LocalMapStats stats2 = member2.getMap(mapName).getLocalMapStats();
IMap<Integer, Integer> map = client.getMap(mapName);
int operationCount = 1123;
for (int i = 0; i < operationCount; i++) {
map.put(i, i);
map.get(i);
map.remove(i);
}
assertEquals("put count", operationCount, stats1.getPutOperationCount() + stats2.getPutOperationCount());
assertEquals("get count", operationCount, stats1.getGetOperationCount() + stats2.getGetOperationCount());
assertEquals("remove count", operationCount, stats1.getRemoveOperationCount() + stats2.getRemoveOperationCount());
assertTrue("put latency", 0 < stats1.getTotalPutLatency() + stats2.getTotalPutLatency());
assertTrue("get latency", 0 < stats1.getTotalGetLatency() + stats2.getTotalGetLatency());
assertTrue("remove latency", 0 < stats1.getTotalRemoveLatency() + stats2.getTotalRemoveLatency());
}
use of com.hazelcast.monitor.LocalMapStats in project hazelcast by hazelcast.
the class ClientMapTest method testMapStatistics.
@Test
public void testMapStatistics() throws Exception {
String name = randomString();
IMap<Integer, Integer> map = client.getMap(name);
int operationCount = 1000;
for (int i = 0; i < operationCount; i++) {
map.put(i, i);
map.get(i);
map.remove(i);
}
LocalMapStats localMapStats = server.getMap(name).getLocalMapStats();
assertEquals("put count", operationCount, localMapStats.getPutOperationCount());
assertEquals("get count", operationCount, localMapStats.getGetOperationCount());
assertEquals("remove count", operationCount, localMapStats.getRemoveOperationCount());
assertTrue("put latency", 0 < localMapStats.getTotalPutLatency());
assertTrue("get latency", 0 < localMapStats.getTotalGetLatency());
assertTrue("remove latency", 0 < localMapStats.getTotalRemoveLatency());
}
Aggregations