Details
-
Enhancement
-
Resolution: Fixed
-
P4
-
11
-
b13
-
generic
-
generic
-
Verified
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8267470 | 11.0.13-oracle | Prasadarao Koppula | P4 | Resolved | Fixed | b01 |
JDK-8272460 | 11.0.12.0.2-oracle | Prasadarao Koppula | P4 | Closed | Fixed | b01 |
JDK-8263878 | 11.0.12 | Xuelei Fan | P4 | Resolved | Fixed | b01 |
JDK-8265178 | openjdk8u302 | Xuelei Fan | P4 | Resolved | Fixed | b01 |
JDK-8267600 | 8u311 | Prasadarao Koppula | P4 | Resolved | Fixed | b01 |
JDK-8269608 | 8u301 | Prasadarao Koppula | P4 | Resolved | Fixed | b31 |
JDK-8268026 | 8u291 | Prasadarao Koppula | P4 | Closed | Fixed | b34 |
Description
Background:
we observed that some of our servers were slow to respond, even though there were sufficient available hardware resources. Thread dump taken during such event pointed to multiple threads blocked on MemoryCache.put, with a single thread executing expungeExpiredEntries:
java.lang.Thread.State: RUNNABLE
at sun.security.util.MemoryCache.expungeExpiredEntries(java.base@11.0.8/Unknown Source)
at sun.security.util.MemoryCache.put(java.base@11.0.8/Unknown Source)
- locked <0x000000040ce43068> (a sun.security.util.MemoryCache)
at sun.security.ssl.SSLSessionContextImpl.put(java.base@11.0.8/Unknown Source)
Analysis:
When the cache is full of recent (non-expired) entries, expungeExpiredEntries is called on every put. This operation does a full scan of the cache, linear in the size of the cache.
That scan can be easily avoided by setting either infinite capacity or infinite session timeout; both make the put operation constant-time again. However, infinite capacity quickly leads to
Enhancement request:
Make the put operation constant-time (or amortized constant) in cache size even when both max size and lifetime limits are set.
Data:
JMH benchmark of MemoryCache.put run on current git master (jdk 17) gives the following result on my machine:
Benchmark (size) (timeout) Mode Cnt Score Error Units
CacheBench.put 20480 86400 avgt 25 83.653 ? 6.269 us/op
CacheBench.put 20480 0 avgt 25 0.107 ? 0.001 us/op
CacheBench.put 204800 86400 avgt 25 2057.781 ? 35.942 us/op
CacheBench.put 204800 0 avgt 25 0.108 ? 0.001 us/op
Other reports:
Session cache performance problems were also reported in JDK-8202086 and
Attachments
Issue Links
- backported by
-
JDK-8263878 Improve SSL session cache performance and scalability
- Resolved
-
JDK-8265178 Improve SSL session cache performance and scalability
- Resolved
-
JDK-8267470 Improve SSL session cache performance and scalability
- Resolved
-
JDK-8267600 Improve SSL session cache performance and scalability
- Resolved
-
JDK-8269608 Improve SSL session cache performance and scalability
- Resolved
-
JDK-8268026 Improve SSL session cache performance and scalability
- Closed
-
JDK-8272460 Improve SSL session cache performance and scalability
- Closed
- relates to
-
JDK-8253116 Performance regression observed post upgrade to 8u261
- Resolved
-
JDK-8202086 Improve performance characteristics of sun.security.util.MemoryCache
- Open
-
JDK-8210985 Update the default SSL session cache size to 20480
- Resolved