High CPU due to multiple Java threads accessing TreeMap simultaneously

Solution Verified - Updated -

Issue

  • High cpu.
  • Thread(s) consuming cpu have TreeMap at the top of the stack trace. For example:
    "ajp-0.0.0.0-8209-2" daemon prio=10 tid=0x08668800 nid=0x38e runnable [0x4c382000]
       java.lang.Thread.State: RUNNABLE
         at java.util.TreeMap.put(TreeMap.java:552)
    ...
    "ajp-0.0.0.0-8209-3" daemon prio=10 tid=0x08343000 nid=0x3cf runnable [0x4c23e000]
       java.lang.Thread.State: RUNNABLE
         at java.util.TreeMap.getEntry(TreeMap.java:335)
         at java.util.TreeMap.get(TreeMap.java:255)
    ...
    "ajp-0.0.0.0-8209-4" daemon prio=10 tid=0x08409400 nid=0x408 runnable [0x4bee9000]
       java.lang.Thread.State: RUNNABLE
         at java.util.TreeMap.getEntry(TreeMap.java:335)
         at java.util.TreeMap.get(TreeMap.java:255)
    ...
    "ajp-0.0.0.0-8209-5" daemon prio=10 tid=0x089d9c00 nid=0x448 runnable [0x4c28f000]
       java.lang.Thread.State: RUNNABLE
         at java.util.TreeMap.put(TreeMap.java:552)
    ...
    

Environment

  • Java

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content