AxonFramework native on MacOS M1

I just released v1.7.0 of my showcase-quarkus-eventsourcing. It now runs on GraalVM Community Edition 22.2.0 with Java 17.

This makes it possible to build a native image for MacOS M1🎉.

I’ve tried it out and it blew my mind: A native executable of about 85 MB containing the whole (ok a small) Quarkus + AxonFramework + UI application that starts in 0,064 seconds.

7 Likes

@JohT you are living in 2050 while us peasants are still in 2022 :scream:

0.064 seconds cold start is some feat!

1 Like

@vab2048 :grin:, just wiring up open source tools and frameworks. Credit goes to them including AxonFramework.

1 Like

Wow that’s great. I implemented a quarkus extension for axon. I tried already once to compile a native image, but I failed.

It would be great if you could give me hints how you solved the problems.

Btw. the extension can be found here: GitHub - meks77/quarkus-axonframework-extension: Quarkus Extension for the Axon Framework

1 Like

Sorry, I’ve overseen it. I’ll have a look and see if I can find something out.

No problem, I am glad that you answered

First of all: Great work :+1:. I intentionally didn’t write an extension because I knew that this is a lot of work :grinning:.

It’s been a while since I contributed to Quarkus and I’ve never wrote an extension. So I won’t be a big help for you regarding that.

At least I can share my main struggle with the native image build and how I resolved it:

The native image build removes Reflection and other things (Tips for writing native applications). To overcome this, there are configuration files and I’m sure also programatic ways in an extension.

I started with some manual configuration entries and hopped from one error message to the next. My final solution was then to generate these configuration files by running integration tests with activated Native Image Agent. I’ve documented it in WALKTHROUGH.md - Native Image and README.md - Native Image

Unfortunately, I needed to deactivate my fully automated approach using a GitHub Actions workflow since the generated json files were corrupted due to some (I presume) race conditions when Quarkus is stopped. Nevertheless, the configuration files are “good enough” for my small showcase.

Regarding that, there is also a very interesting collection of configurations: graalvm-reachability-metadata

Another thing that helped me a lot in hindsight is to rely as much as possible on already included things in Quarkus. For examples: I let CDI do all the heavy lifting and rely on how it is implemented in Quarkus (called ArC).

Let me know if this was helpful or share a concrete error message to dig deeper.

Many thanks for the compliments.
I will today evening have a look at the markdown files and will start again with steps for native compilation.

I will let you know latest next week how the progress was.