Reputation: 1520
I have a two box cluster running Hazelcast 3.6.
I am trying to run some very basic tests to get a feel for performance. Gets, puts and an aggregation across a map of Integers are all seriously slow.
I am seeing about 2.6 get or put operations per second. Any idea why this might be?
This is my test code:
public static void main(String[] args) {
ClientConfig clientConfig = new ClientConfig();
clientConfig.getGroupConfig().setName("dev").setPassword("dev-pass");
clientConfig.getNetworkConfig().addAddress("10.90.288.14", "10.90.288.15");
HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
IMap<Integer, Integer> map = client.getMap("int-map");
for (int i = 0; i < 10000; i++) {
map.put(i, i);
System.out.println(i);
}
for (int i = 0; i < 10000; i++) {
map.get(i);
System.out.println(i);
}
System.out.println("Summed:" + map.values().stream().mapToInt(Integer::intValue).sum());
client.shutdown();
System.out.println("Finished");
}
Upvotes: 0
Views: 1247
Reputation: 11307
First thing I would fix is to remove the System.outs on every get since this has a significant overhead. If you really want to log something, add something like this:
if(k%1000==0)println("whatever")
Also you need a lot longer running time to say anything sensible, with 1k runs, you have not even heated up the JIT. So run at least 1M time.
And I would calculate the performance directly by storing the time before you start, and storing the time after the test. And you get something like
long duration=endMs-startMs;
double throughput = (1000d*iteration)/duration
Upvotes: 1