Java's new AOT cache feature is in a rough state
Posted by theanonymousone 3 days ago
Comments
Comment by lazystone 3 hours ago
> Non-Goals
> It is not a goal to support cross-compilation. Code compiled in a training run must run on the same CPU architecture, with the same set of features, in subsequent production runs.
Comment by crschnick 3 hours ago
Comment by florieger 3 hours ago
IMHO, that would be much better than running into crashes and having to figure out the cause yourself.
Comment by paulddraper 3 hours ago
"This is what I would like AOT cache to mean."
Comment by pron 2 hours ago
The first use case is the very common one (for Java) where developers control deployment (internal deployment). The last basic building block, caching machine code, will be released next year in JDK 28, and then the feature is likely to evolve to better support other use cases, such as external deployment.
Comment by jbellis 2 hours ago
Comment by deepsun 3 hours ago
I think other AOT-compiled languages don't opt in for the lowest set of CPU features -- they just detect them at runtime and use whenever present, all in compiled machine code.
Comment by mikepurvis 3 hours ago
https://doc.rust-lang.org/beta/core/arch/#dynamic-cpu-featur...
Comment by pregnenolone 31 minutes ago
Comment by wokkel 6 minutes ago
Comment by pjmlp 2 hours ago
There are plenty of other AOT/JIT cache approaches in the Java ecosystem already, with more mature deployment experience of several years, namely:
OpenJ9, Azul, PTC, Aicas, the Android cousin since Android 7
Technology based on process snapshots CRaC for Amazon OpenJDK distro (Correcto), and OpenJ9, is also another approach available for some time.
Comment by _old_dude_ 3 hours ago
Comment by emoII 3 hours ago
Comment by hocuspocus 2 hours ago
Struggling to build native images should be a sign you're reliant on libraries that are dangerously outdated and abandoned.
Comment by jcurtis 1 hour ago
Comment by emoII 1 hour ago
Comment by crschnick 31 minutes ago
The AOT cache compatibility issues come when your boot module path differs between training and actual run. As long as that is not the case, you can use it without problem and load additional modules at runtime after it has started up.
With GraalVM, that is not possible. It still has the closed-world assumption.
Comment by jiehong 3 hours ago
Instead, this AOT feature is not very ergonomic to use at all, with too many pitfalls to be of broad use IMO.
Comment by JMKH42 3 hours ago
Comment by pron 2 hours ago
Comment by phi_node_48 1 hour ago