Hazelcast put is running very slow

191 views
Skip to first unread message

dharamt...@gmail.com

unread,
May 20, 2016, 9:29:49 AM5/20/16
to Hazelcast
Hi Team,

Could some one help me with below confusion?  I really don't understand why Hazelcast vs Ignite put timings are varying so much. [8.33 Mins vs 15 Seconds]

Hazelcast:
I am trying to run simple test with Hazelcast 3.6 and observing put/s statistics from Management Center. Person class is using "StreamSeriazer" [Though I tried first using plain java serialization as well]

/*
Person class: [Backup count is set as 0]
public Person(String personId, String personName, int age, String address, String cellNumber, String companyWorking,
            long salary, boolean isMarried, boolean ownsTwoWheeler, boolean ownsFourWheeler, int numOfDependands)
*/


        HazelcastInstance hz = HazelcastClient.newHazelcastClient();
        IMap<Integer, Person> personMap = hz.getMap("person");
        System.out.println("** Entering into critical section ***");
       
        long time = System.currentTimeMillis();
        final int iterations = 1000000;
       
        for(int i=0;i<iterations;i++) {
            personMap.put(i, new Person(String.valueOf(i),"Person"+i,i,"Address"+i,"99309271"+i,"JPMC"+i,(2000+1)*(i+1),true,false,false,i+1));
        }
       
        long time1 = System.currentTimeMillis();
        System.out.println("** Put time : " + (time1-time) + " **");

Output:
** Entering into critical section ***
** Put time : 536168 **

From Management Center:
Total Heap  :  6060 MB
Used Heap : 624 MB
Heap Usage Percentage : 11%
Put/s statistics : Average 1700 puts per second , latency : 0.02 ms


Apache Ignite:

Ignite ignite = Ignition.start("appContext.xml");
        IgniteCache<Integer, Person> cache = ignite.getOrCreateCache("SampleCache");
       
        Thread.sleep(15000);
        System.out.println("** Entering into critical section ***");
       
        long time = System.currentTimeMillis();
        final int iterations = 1000000;
       
        for(int i=0;i<iterations;i++) {
            cache.put(i, new Person(String.valueOf(i),"Person"+i,i,"Address"+i,"99309271"+i,"JPMC"+i,(2000+1)*(i+1),true,false,false,i+1));
        }
       
        long time1 = System.currentTimeMillis();
        System.out.println("** Put time : " + (time1-time) + " **");
       
        System.out.println("Size is:" + cache.size(CachePeekMode.ALL));

Output:
** Put time : 15795 **
Size is:1000000

May 20, 2016 5:43:51 PM org.apache.ignite.logger.java.JavaLogger info
INFO:
Metrics for local node (to disable set 'metricsLogFrequency' to 0)
    ^-- Node [id=8d25690b, name=null]
    ^-- H/N/C [hosts=1, nodes=1, CPUs=12]
    ^-- CPU [cur=0.17%, avg=0.71%, GC=0%]
    ^-- Heap [used=880MB, free=85.47%, comm=6060MB]
    ^-- Public thread pool [active=0, idle=24, qSize=0]
    ^-- System thread pool [active=0, idle=24, qSize=0]
    ^-- Outbound messages queue [size=0]

Thanks,
Dharam



Jaromir Hamala

unread,
May 20, 2016, 9:52:11 AM5/20/16
to Hazelcast
Hello Dharam,

If I'm reading your code correctly then I believe you are using client-server topology for Hazelcast, but just a local member for the other test. This makes it a bit unfair. Can you replace `HazelcastClient.newHazelcastClient();` with `Hazecast.newHazelcastInstance()` in your code? Also make sure you have the same number of members running. 

Please bear in mind benchmarks where just a single member is used typically don't have a massive value. A cluster of 10 members running on 10 different boxes would be a better test. 
Also both products use different defaults: I believe they use async backups and they also allow reading from backups by default. This is basically a trade-off between consistency and performance and we tend to be more conservative here. You can enable reading from backups and set async backups

Cheers,
Jaromir

Dharam Thacker

unread,
May 21, 2016, 2:36:30 AM5/21/16
to Hazelcast
Thank you Jaromir ! Got it.
Reply all
Reply to author
Forward
0 new messages