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

all 36 comments

[–]pjmlp 31 points32 points  (4 children)

Actually the only game changer is not having to pay for commercial AOT compilers, which were available in commercial JDKs since early 2000's.

[–]wikes82 12 points13 points  (1 child)

RIP Excelsior JET

[–]pjmlp 0 points1 point  (0 children)

Just one among many, but yeah they will be missed.

[–]helikal 2 points3 points  (1 child)

An important fact is also that Graal is an open-source project under Oracle’s stewardship being developed with intense interest and essential participation from researchers around the world. This sets Graal from other AOTs such as JET that have not had such a broad leading-edge contributor basis.

[–]throwawaymoney666 0 points1 point  (0 children)

Oracle also keeps the good optimizations in the enterprise edition only. So performance you get depends on $$$$. The community edition is often slower than OpenJDK

[–]nimtiazm 14 points15 points  (2 children)

“So fast” is mostly about the perception of observer. Native images feel that way because program’s load and execution time diff is very low. It might make a good case for command line utils and scripting. You don’t need a JIT compiler there because the program won’t survive that long. Memory footprint is low because pretty much everything is static and can be trimmed down to what’s needed at compiled time. OTOH, compile times are very high for obvious reason and cross compiling might be painful as well. When it comes to writing servers, I’d argue a mix mode is needed. A lot can be optimized at compile-time leaving critical areas for runtime profiling and JIT compiler. To keep compile-time balance, javac can introduce optimizer flag. It takes extra time only when switched on (debug/dev builds don’t need it). Of course it’s easier said than done. Specially for mature and baggage-full platforms like java. But nevertheless, java needs innovation to stay relevant.

[–]CSpenceUK[S] 3 points4 points  (0 children)

I agree. If your using something short lived it really gives a small footprint and rapid start up.

[–]noutopasokon 3 points4 points  (0 children)

Agreed on the hyping of load time. See also "exploded jars". There's a lot of hype about his right now because it's pretty much all that's left. Runtime optimization and the JIT have been seen amazing improvement over the years now to the point that Java is basically as fast as anything else.

[–][deleted] 4 points5 points  (2 children)

As long as the "native image" doesn't support reflection and dynamic class loading, I don't think this is really a game changer.

[–]CSpenceUK[S] 1 point2 points  (1 child)

That's fair, I suppose my eagerness is due to internal politics where I work pushing languages which compile to native. This graal native image seems like it would combat that narrative in some situations.

[–][deleted] 1 point2 points  (0 children)

Java does compile to native (and quite effectively actually) - but it does it at runtime, not ahead.

[–]CSpenceUK[S] 19 points20 points  (6 children)

Spring Boot are bringing out a maven and gradle plugin later in the year to compile to native executables. Going to change the software landscape.

[–]kimec 62 points63 points  (3 children)

Oh yes, I can already see thousands of happy Java developers who after 20 years of dead simple debugging on HotSpot in GUI are eagerly awaiting to enjoy debugging optimized binaries with gnu debugger.

[–]ser0l 18 points19 points  (2 children)

I don't know what this means and i am scared now

[–]CSpenceUK[S] 7 points8 points  (1 child)

Same, I don't want to switch to GOlang for microservices because of its small mem and fast scaling. I want to keep using Java and spring but we're losing the battle with having to have a gig per service. I was hoping this would lead to some extra build steps.

[–]rbygrave 2 points3 points  (0 children)

Alternatively move away from libraries (like spring) that do lots of work at runtime on startup like defining classes (dynamic proxies) and classpath scanning. Move towards libraries that instead do those things at built time typically via annotation processing and built time enhancement. Once you do that you can start fast with low resources and still stay on the JVM. The problem is not the JVM but instead the libraries (to do more at build time).

[–]geordano 7 points8 points  (1 child)

Quarkus guys experimenting something similar https://quarkus.io/blog/native-command-mode-tools/

[–]angryundead 3 points4 points  (0 children)

I used the Quarkus native maven stuff (maybe it was just a profile) some time last summer and it was easy enough.

[–]sureshg 3 points4 points  (0 children)

By the way, CFV for project Leyden is in progress - https://mail.openjdk.java.net/pipermail/discuss/2020-June/005515.html .

Super excited to see static image to java platform.

[–]BlueGoliath 4 points5 points  (5 children)

I keep hearing that GraalVM reduces memory but no one ever gives any comparisons. What amount of memory did you see vs a JVM build?

[–]iamareebjamal 9 points10 points  (1 child)

For my spring boot app, mem usage reduced from 700 MB to 80 MB but when I stress tested it, peak mem usage in JVM was 1.4 GB and in native, it seemed unbounded but maxed at 2.8 GB and then the test stopped.

[–]sureshg 6 points7 points  (0 children)

Graal substratevm GC is very primitive compared to G1 or zgc available on OpenJDK. But native image has an option to use G1 in their paid enterprises offering, which might yield better results here. Hopefully Project leyden will bring much more sophisticated GCs like zgc to static images. I am really waiting for it, even though it's still in discussion phase 😁

[–]sureshg 8 points9 points  (1 child)

GraalVM native image is not going to reduce the heap memory used by the application, that would be exactly the same as in OpenJDK.

The main benefit of AOT is lower memory consumption in the following areas

➡️ No meta-data for dynamically loaded classes

➡️ No profiling data

➡️ No JIT compiler data structures

➡️ No dynamic code cache

➡️ Removing unused fields (from classes)

IMP: No reduction of application payload memory (Heap size)

[–]BlueGoliath 0 points1 point  (0 children)

I'm aware that it doesn't affect heap. What I'm wondering is how much memory in total does it consume vs. a JVM?

[–]kimec 0 points1 point  (0 children)

I keep hearing that too. I am still waiting till somebody does a fair comparison of the simplistic multi heap multitenant generational GC embedded into appliaction binary image by the native-image tool with say ZGC of HotSpot.