4 ms·
> What do I need to have a simple "hello world" CLI Java app which starts within 25ms and doesn't eat more than 10MB of RAM? Is GrallVM enough? Yup. Here is an
by BenoitP 8y ago
> What do I need to have a simple "hello world" CLI Java app which starts within 25ms and doesn't eat more than 10MB of RAM? Is GrallVM enough?
Yup. Here is another tutorial [1]. There are limitations, though:
* It's AOT, which means you don't get the JVM peak performance that come from JITting to your wordload profile. (but maybe in the future we can have startup in AOT then transition to JIT?)
* You're getting an embedded generational garbage collector. Not the sweet stuff like G1/ZGC/Shenandoah.
* You can't do dynamic class loading, or you have to declare (and know) beforehand which classes are reachable. A fair amount of frameworks use this and will not work with native-image. I suspect these will provide mechanisms to help in this regard in the future (for JSPs: generating the code of all classes-pages that are reachable at compile-time).
* There are other limitations [2].
All in all, great for CLIs and cloud lambdas.
[1] https://medium.com/graalvm/instant-netty-startup-using-graalvm-native-image-generation-ed6f14ff7692 https://medium.com/graalvm/instant-netty-startup-using-graal...
[2] https://github.com/oracle/graal/blob/master/substratevm/LIMITATIONS.md https://github.com/oracle/graal/blob/master/substratevm/LIMI...
- deadc0de 8y agoAOT implementation in the JDK, that we call the "HotSpot AOT" implements tiered compilation (look for $JAVA_HOME/bin/jaotc). It is also based on Graal, but with a different set of plugins. You get reasonably good startup and re-JITing afterwards. Of course it doesn't give you compactness on the SVM, but it supports regular java code with class loading, reflection, etc. A talk about HotSpot AOT: https://youtu.be/n5DCg6M2MDM https://youtu.be/n5DCg6M2MDM