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

BigInteger Performance Drop in JDK11

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      linux_redhat_6.0

      Description

      A DESCRIPTION OF THE PROBLEM :
      Hi,

      We have been using BouncyCastle from the last two years in our project with openjdk version "1.8.0_191"

      We use it for RSA decryption, SHA-256, MGF1 with PKCS8 encoded private key and there have been no performance issues whatsoever.

      Now, in our recent release, we see that for the same load, the CPU cycles went up from the range of 68-69% to 80-81%, which is a substantial increase.

      As, the bouncy castle code is fairly stable and our requirements have not change even a bit, so there is no code change in the application side. Only change is that we have moved to openjdk-11.05.

      I took JFR and analyzed further. All the method profiling points to BigInteger.

      The most sampled method was MutableBigInteger.add(MutableBigInteger), with 4.52 % of possible samples during a 30 s window of the recording.
      The following methods are the most interesting candidates for code optimization:
      •java.math.MutableBigInteger.add(MutableBigInteger) (4.52 %) 13/07/2020, 6:26:02 PM – 6:26:32 PM

      To be more sure, I did some more tests. I extracted the decryption code from my application into a separate JAVA program. I took a working encrypted text + private key and hardcoded the same in the program. The program has the ability to specify how many decryptions I want to do in a set and how many times I want to execute that set.
      I built and ran the same with openjdk-1.8.0.191, openjdk-11.0.5, openjdk-14.0.1 and here are the results. I used the latest bouncycastle lib (bc-prov-1.6.6) for these tests.

      For 100000 decryptions,
      time taken by JDK 8 is 230809
      time taken by JDK 11 is 237272
      time taken by JDK 14 is 228715

      So if you check Java8 and Java14 are performing better than Java11. When the number of decryptions (set size) increases, then the difference is huge, e.g. for 100000 decryptions Java8 takes 6463 ms = 6.5s less than Java11 and Java14 takes 8557ms=8.5s less than Java11


        Attachments

          Activity

            People

            Assignee:
            tongwan Andrew Wang
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: