Profiling the TLS handshakes using SSLHandshake benchmark shows that a large portion of time is spent in HandshakeContext initialization, specifically in DisabledAlgorithmConstraints class.
There are only a few instances of that class, and they are immutable. Caching the results should be a low-risk operation. The cache is implemented as a softly reachable ConcurrentHashMap; this way it can be removed from memory after a period of inactivity. Under normal circumstances the cache holds no more than 100 algorithms. ------------- Commit messages: - Implement constraint cache Changes: https://git.openjdk.java.net/jdk/pull/8349/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8349&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8285398 Stats: 26 lines in 1 file changed: 23 ins; 1 del; 2 mod Patch: https://git.openjdk.java.net/jdk/pull/8349.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/8349/head:pull/8349 PR: https://git.openjdk.java.net/jdk/pull/8349