回复:Need Information for memory sharing with AppCDS

向伟(识月) shiyue.xw at alibaba-inc.com
Mon Mar 9 06:55:26 UTC 2020


Hi Ioi,

Thanks a lot for your information.
I have the question about the usage in the document:
For common class path prefix:
---------------------------------------
    Run the Hello and Hi applications with the same shared archive:
java -XX:SharedArchiveFile=common.jsa -cp common.jar:hello.jar:hi.jar Hello
java -XX:SharedArchiveFile=common.jsa -cp common.jar:hello.jar:hi.jar Hi

If a class with name ABC is both in hello.jar and hi.jar, the content is different.
With the class path -cp common.jar:hello.jar:hi.jar, the second run "java .. Hi" can't load the correct class ABC in hi.jar.

Is there any solution for this usage?

Thanks,
Wei Xiang  
------------------------------------------------------------------
发件人:Ioi Lam <ioi.lam at oracle.com>
发送时间:2020年3月9日(星期一) 13:03
收件人:hotspot-runtime-dev <hotspot-runtime-dev at openjdk.java.net>
主 题:Re: Need Information for memory sharing with AppCDS

On 3/8/20 8:51 PM, 向伟(识月) wrote:
> Hi,
>
> We am trying to take advantage of the characteristics of memory sharing with AppCDS, and we expected that the
> JVM internal packages and common packages can be shared with AppCDS.
>
> In the user scenario, there are some common base packages for different Java processes with "-cp common_path"
> Process A: -cp common_path:pathA
> Process B: -cp common_path:pathA:pathB
> Process C: -cp common_path:pathC
>
> I check the code in JDK11, and it uses SharedPathsMiscInfo to do the consistency check for class path.
> The below usage can work in JDK11
> Dump stage:
> -cp common_path
>
> Runtime stage:
> -cp  common_path:new_path
>
> But I find that SharedPathsMiscInfo has been removed in the latest JDK code.
>
> I need the information:
> 1. the new flow to do the consistency check.
> 2. constraint condition about the memory sharing among the different Java processes.
>
> Is there any user guide to use the memory sharing feature for AppCDS?

Hi Wei,

The topic of sharing the same CDS archive between different apps that 
have the same classpath prefix can be found here:

https://docs.oracle.com/en/java/javase/13/docs/specs/man/java.html#application-class-data-sharing

See the section "Sharing a Shared Archive Across Multiple Application 
Processes".

SharedPathsMiscInfo was removed in this RFE in JDK 14: 
https://bugs.openjdk.java.net/browse/JDK-8227370

However, we still enforce the same set of consistency checks as previous 
JDK versions.

Please let me know if you have further questions.

Thanks
- Ioi

> Thanks,
> Wei Xiang



More information about the hotspot-runtime-dev mailing list