JDK-8231610 : Relocate the CDS archive if it cannot be mapped to the requested address
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 14
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-09-30
  • Updated: 2022-11-10
  • Resolved: 2019-11-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 14
14 b24Fixed
Related Reports
Blocks :  
Blocks :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
The CDS archive is mmaped to a fixed address range (starting at SharedBaseAddress, usually 0x800000000). If this requested address range is not available (usually due to Address Space Layout Randomization (ASLR)), the JVM will give up and will load classes dynamically using class files.

To improve start-up time, especially on systems with ASLR, we should try to mmap the CDS archive to an alternate address (chosen by the OS). Here are some preliminary benchmarking results (using default CDS archive, running helloworld):

(a)       47.1ms (CDS enabled, mapped at requested addr)
(b)       53.8ms (CDS enabled, mapped at alternate addr)
(c)       86.2ms (CDS disabled)

The small degradation in (b) is caused by the relocation of absolute pointers embedded in the CDS archive. However, it is still a big improvement over case (c).
======
In our testing environment, we have a fairly small number of mapping failures (below 1%), so I don't think the performance degradation caused by relocation matters too much. However, now that we can guarantee that CDS is always enabled, we can do more optimizations. E.g., AOT-compiled code can now have references into the CDS data and can assume that it's always available. So hopefully CDS can be used as a basic building block for future optimization work. 

Comments
https://github.com/openjdk/jdk/commit/5678f98a9e5ac03195e9421482746a845e6bc82d
09-11-2022

URL: https://hg.openjdk.java.net/jdk/jdk/rev/22ee476cc664 User: iklam Date: 2019-11-14 02:39:58 +0000
14-11-2019

Thumbs up!
30-09-2019