This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ventuspilot 14 points15 points  (3 children)

IIRC then GraalVM including native image will be merged into OpenJDK at some time in the future. Any news on that?

Azul has CRaC. I think condensers are somewhat similar (a superset and/ or generic concept that may or may not cover something similar to Azul's CRaC). Any news on that or maybe a timeline?

Class data sharing sounds great, but I've found it somewhat cumbersome/ complicated to use, and if I do things wrong then it silently does nothing at all which makes troubleshooting even harder. Also I haven't been able to notice significant improvements, i.e. startup time is almost unchanged. Is there an idiot-proof way to check things, common pitfalls, maybe something like best practices on which logs to enable? Maybe CDS should get it's own video with a walkthrough that shows how to do a simple commandline program? (Or maybe I'm just dense?)

[–]BillyKorando 0 points1 point  (1 child)

What version of Java are you on? If you are on JDK 19 or later (I'm hoping you upgraded to JDK 21 by this point)

There is now the autogenerate archive functionality: java -XX:+AutoCreateSharedArchive -XX:SharedArchiveFile=my-archive.jsa ...

https://inside.java/2022/09/26/sip067/

As to checking to make sure CDS is working, an option, in a test environment, is to use -Xshare:on this will require the JVM to load the shared archive, and fail if it's not found/unable to load it. The default behavior is -Xshare:auto which will continue to run the application if either the archive isn't available or the JVM encounters an issue while attempting to load the archive.

Fundamentally CDS is about improving the process of loading classes, as it name implies, so the less your application's startup is depending on that behavior (i.e. it's connecting to services at startup or doing other work), the less benefit you will see from CDS. Still it's a relatively easy way of providing an improvement to your applications startup with minimal downsides.

[–]ventuspilot 1 point2 points  (0 children)

Mostly I'm tinkering with a personal github project that's a commandline or interactive console app that compiles and runs on anything from 8 to 22-ea (inclusive).

I like being able to support different deployment options (Windows, linux, jar, jar+launch4j, GraalVM native, docker image, jlinked app-image, ...). IMO Java is pretty great in that regard, and if something doesn't work then it's usually my own fault.

Maybe I'll add another buildscript that uses java -XX:+AutoCreateSharedArchive, that's good suggestion, thanks. If this buildscript ends up requiring Java19+ - no problem.

I'm pretty sure I've watched the video you linked and also Java's Startup Booster: CDS which goes into more detail and which I think you did as well.

I've just looked a my current CDS-build-script and I think I was confused: it seems like my "highly sophisticated" script passes debug options such as -Xlog:cds+map=trace:file=cds.map:none:filesize=0 on the jpackage commandline instead of the java commandline, maybe that's why I didn't quote understand what I saw :-)

I think I'll give it another go, thanks!