RFR: JDK-8255603: Memory/Performance regression after JDK-8210985

Andrew Haley aph at openjdk.java.net
Fri Oct 30 10:36:43 UTC 2020


On Thu, 29 Oct 2020 15:11:09 GMT, Christoph Langer <clanger at openjdk.org> wrote:

> It seems that there exists a memory/performance regression that was introduced with JDK-8210985: Update the default SSL session cache size to 20480.
> 
> The idea to limit the maixmum SSL session cache size by itself is good. Unfortunately, as per the current implementation of sun.security.util.MemoryCache, it also modifies the initial size of the LinkedHashMap that is backing the cache to initialize with more than the maximum size.
> 
> I suggest to restore the original behavior that initializes with an initialCapacity of 1 in most cases. That was true when before JDK-8210985, the property javax.net.ssl.sessionCacheSize was not set at all.
> In case it was set, the initial size would have been like now, (javax.net.ssl.sessionCacheSize / 0.75f) + 1, which still seems strange.

Marked as reviewed by aph (Reviewer).

src/java.base/share/classes/sun/security/util/Cache.java line 268:

> 266:             this.queue = null;
> 267: 
> 268:         cacheMap = new LinkedHashMap<>(1, LOAD_FACTOR, true);

This looks right. The idea of scaling the initial cache size to the maximum size seems obviously to be wrong.

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

PR: https://git.openjdk.java.net/jdk/pull/937



More information about the security-dev mailing list