Topic
2 replies Latest Post - ‏2013-11-02T02:56:20Z by 52Y5_yohan_shanaka
52Y5_yohan_shanaka
52Y5_yohan_shanaka
2 Posts
ACCEPTED ANSWER

Pinned topic High CPU Utilisation when concurrent threads accessing Hashset().Add()

‏2013-10-30T09:04:54Z |

High CPU utilisation was reported while concurrent threads accessing Hashset().Add() method.

This thread is "Waiting on condition" while consume high CPU, this happening on JRE 1.6.0 sr14

Under AIX environment. CPU 65%-90% and not going gown after that.

Memory allocation -Xms1024M -Xmx2048M

Java version : JRE 1.6.0 AIX ppc-32 build jvmap3260sr14-20130704_155156 (pap3260sr14-20130705_01(SR14))

at java/util/HashMap.findNonNullKeyEntry(HashMap.java:601(Compiled Code))
at java/util/HashMap.putImpl(HashMap.java:697(Compiled Code))
at java/util/HashMap.put(HashMap.java:680(Compiled Code))
at java/util/HashSet.add(HashSet.java:102(Compiled Code))

 

When get the thread utilization from ps -mp <Process id> -o THREAD it always points to above code block from the thread dump.

This application use hashset.add() in multithread environment.

  • brataj
    brataj
    39 Posts
    ACCEPTED ANSWER

    Re: High CPU Utilisation when concurrent threads accessing Hashset().Add()

    ‏2013-11-01T22:12:13Z  in response to 52Y5_yohan_shanaka

    Hi Yohan,

    The Javadoc says "The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized", which means if you don't provide synchronization, it is possible to corrupt the hashmap in such a way as to produce an internal reference cycle (loop) that just burns CPU.

    I'm not saying this is in fact the case, but the first thing you should verify in your code...

    Bernie

  • 52Y5_yohan_shanaka
    52Y5_yohan_shanaka
    2 Posts
    ACCEPTED ANSWER

    Re: High CPU Utilisation when concurrent threads accessing Hashset().Add()

    ‏2013-11-02T02:56:20Z  in response to 52Y5_yohan_shanaka

    Hi Bernie,

    Thanks, for the reply

    My worry for this, same code base worked in IBM JRE 1.5 without any trouble for few years. this problem appeared once we upgrade JRE to 1.6.

    so, I think this is a IBM JVM 1.6 issue rather coding problem.

    Please keep posting.

    Regards,

    Yohan R