High CPU due to multiple Java threads accessing HashMap simultaneously

Solution Verified - Updated -

Issue

  • High cpu and threads consuming the CPU have HashMap access at the top of the stack trace. For example:
"RMI TCP Connection(4468)-160.57.110.76" daemon prio=6 tid=0x5a436400 nid=0x9e4 runnable [0x6068d000]
   java.lang.Thread.State: RUNNABLE
     at java.util.HashMap.get(HashMap.java:303)
     at com.example.service.getWidget(Component.java:796)
...

"WorkManager(3)-122" daemon prio=6 tid=0x5b496000 nid=0x18fc runnable [0x70b2e000]
   java.lang.Thread.State: RUNNABLE
     at java.util.HashMap.get(HashMap.java:303)
     at com.example.service.getWidget(Component.java:796)
...

Environment

  • Java
  • JBoss Enterprise Application Platform (EAP)

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In