Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8317960

[17u] Excessive CPU usage on AbstractQueuedSynchronized.isEnqueued

XMLWordPrintable

      We've seen several services running JDK17 with excessive CPU wasted on AbstractQueuedSynchronizer.isEnqueued. Calls to this method may represent up to 25% of CPU usage in some services, with more hovering around the 10% mark. We did not see this with JDK11 (AQS relevant methods were added in JDK14 as part of JDK-8229442) or JDK21

      Top of the stack for that block consists of:
      java/util/concurrent/locks/AbstractQueuedSynchronizer.isEnqueued (24.60%)
      java/util/concurrent/locks/AbstractQueuedSynchronizer$ConditionObject.canReacquire (24.60%)
      java/util/concurrent/locks/AbstractQueuedSynchronizer$ConditionObject.await (26.39%)
      java/util/concurrent/ScheduledThreadPoolExecutor$DelayedWorkQueue.take (27.75%)

      Testing the same applications with JDK21 causes all that CPU usage to go away, with AbstractQueuedSynchronizer$ConditionObject.await taking just (0.11% of cpu).

      It seems the performance fix comes from JDK-8277090. Backporting the AQS related changes to JDK17 seems to fix the performance issue, although it is not clear based on JDK-8277090 if those changes are dependent on other

        1. AQS JDK17.png
          203 kB
          David Alvarez
        2. AQS JDK21.png
          289 kB
          David Alvarez
        3. jdk17-aqs.patch
          2 kB
          David Alvarez

            alvdavi David Alvarez
            alvdavi David Alvarez
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: