Fat jar with AppCDS

Ioi Lam ioi.lam at oracle.com
Mon Apr 30 22:05:58 UTC 2018


Hi Volker,

Thank you so much for writing the tool. We have written some internal 
tools that work similarly. As you said, the current interface is awkward 
(because it's experimental). I have some ideas for how to improve 
support for custom loaders in CDS, and I'll send out a separate mail for 
discussion.

I have made a small patch your cl4cds tool to support "fat" JAR files. 
You can find the patch and a test case from:

     http://cr.openjdk.java.net/~iklam/jdk11/fatjarcds/

It basically extract all entries like

jar:file:/jdk/tmp/test-1.0-SNAPSHOT.jar!/BOOT-INF/lib/validation-api-2.0.1.Final.jar!/

into a local file

     ./tmp/BOOT-INF/lib/validation-api-2.0.1.Final.jar

and read from this location during archive dumping.


Yumin, could you try it out and see if it works for you?

Thanks
- Ioi


On 4/24/18 11:14 PM, yumin qi wrote:
> Hi, Volker
>
>   Thanks! I will try your tool.
>
> Yumin
>
> On Tue, Apr 24, 2018 at 5:42 PM, Volker Simonis 
> <volker.simonis at gmail.com <mailto:volker.simonis at gmail.com>> wrote:
>
>     Hi Yumin,
>
>     your right with your observation. For applications like Tomcat or
>     Eclipse you can currently usually only share about 20%-30% of the
>     application classes, even with AppCDS.
>
>     To overcome this problem I wrote a small tool called "cl4cds" (i.e.
>     class list for CDS) which can be used to generate a classlist out of
>     the "Xlog:class+load" output. Unfortunately this is currently an
>     extra, off-line step which should obviously be integrated right into
>     HotSpot. But for the time being it allows you to take advantage of
>     AppCDS for custom classloaders and share a much bigger amount of
>     classes even for application server scenarios.
>
>     Regards,
>     Volker
>
>     [1] https://github.com/simonis/cl4cds
>     <https://github.com/simonis/cl4cds>
>
>     On Tue, Apr 24, 2018 at 2:49 AM, yumin qi <yumin.qi at gmail.com
>     <mailto:yumin.qi at gmail.com>> wrote:
>     > Hi,Ioi
>     >
>     >   There are some applications with fat jar, that is, like web
>     jars, are
>     > loaded by its own class loaders, are not dumped when run with
>     current mode.
>     > AppCDS can dump the jars in path and loaded by App class loader,
>     but it
>     > does not dump the classes loaded by the class loader "in the
>     jars", which
>     > are loaded in runtime.
>     >
>     >   Do you have any plan to work on this issue? The classes loaded
>     during
>     > runtime are NOT generated classes, they are just designed this
>     way and
>     > stored in other jar files(fat).
>     >
>     >   We are working on the issue, so if you have recommendation or
>     you already
>     > worked on it please let me know.
>     >
>     > Thanks
>     > Yumin
>
>



More information about the hotspot-runtime-dev mailing list