[jdk17u-dev] RFR: 8298249: Excessive memory allocation in CipherInputStream AEAD decryption

Aleksey Shipilev shade at openjdk.org
Thu Apr 11 14:43:20 UTC 2024


Improves `CipherInputStream` with `AES-GCM` significantly. This problem is seen in some of our services.

There is a related [JDK-8298865](https://bugs.openjdk.org/browse/JDK-8298865), which I would backport separately.

Additional testing:
 - [x] MacOS AArch64 server fastdebug, `jdk_security`
 - [x] Ad-hoc benchmarks 


Benchmark                        (dataSize)  (keyLength)    Mode  Cnt       Score     Error  Units

# Before
AESGCMCipherInputStream.decrypt       16384          128   thrpt   40   35547.250 ± 154.108  ops/s
AESGCMCipherInputStream.decrypt     1048576          128   thrpt   40      17.297 ±   0.043  ops/s
AESGCMCipherInputStream.encrypt       16384          128   thrpt   40  150791.244 ± 656.878  ops/s
AESGCMCipherInputStream.encrypt     1048576          128   thrpt   40    2561.195 ±  27.701  ops/s

# After
AESGCMCipherInputStream.decrypt       16384          128   thrpt   40   65815.523 ± 156.983  ops/s
AESGCMCipherInputStream.decrypt     1048576          128   thrpt   40     786.680 ± 298.170  ops/s
AESGCMCipherInputStream.encrypt       16384          128   thrpt   40  149412.181 ± 431.304  ops/s
AESGCMCipherInputStream.encrypt     1048576          128   thrpt   40    2581.110 ±  23.931  ops/s

-------------

Commit messages:
 - Backport b9074fa1ed489993d60ce873fd8105a95d30782a

Changes: https://git.openjdk.org/jdk17u-dev/pull/2393/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk17u-dev&pr=2393&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8298249
  Stats: 146 lines in 2 files changed: 142 ins; 0 del; 4 mod
  Patch: https://git.openjdk.org/jdk17u-dev/pull/2393.diff
  Fetch: git fetch https://git.openjdk.org/jdk17u-dev.git pull/2393/head:pull/2393

PR: https://git.openjdk.org/jdk17u-dev/pull/2393


More information about the jdk-updates-dev mailing list