[midPoint] midPoint native build

Martin Lízner - AMI Praha a.s. martin.lizner at ami.cz
Thu Nov 25 13:52:36 CET 2021


Hello all!

I'm currently investigating building midPoint as a native-bytecode
application running directly under the OS without a Java Virtual Machine
layer. Imagine there is no runtime JVM, there are no wars and jars, there
is just (mostly one big) binary file executing under your Windows or Linux.
The executable contains everything in it, bits of java runtime,
dependencies, resources, application code.. all thanks to ahead-of-time
compilation (AOT).
The key benefit is performance, such web applications should be faster and
less resource intensive compared to running under JVM in the traditional
way. Of course, performance of integration platforms such as midPoint is
derived vastly from I/O operations, but *achieving GUI speedup should be
realistic*.

https://medium.com/swlh/graalvm-byte-code-to-bit-code-39463aa209b4
https://www.graalvm.org/reference-manual/native-image/

This is what theory says, practically Im still unable to build midPoint as
a native image to validate it. MidPoint is a complex modular spring
application that makes things quite difficult.

I'm wondering if maybe someone from the community had the same idea as me
or if anybody would like to share feedback on the topic. Everything around
native building is in early stages of maturity, but it seems like a
promising new trend in IT. Below I leave some technical hints, I may resume
in the future if I have more time for R&D.

---
Im using GraalVM CE 21.3.0 java17 on linux and midPoint master (4.4). I had
to bump mp's spring boot dependency to 2.5.6. These are two approaches I
have tried so far:

1. Using the experimental spring native plugin:
https://docs.spring.io/spring-native/docs/current/reference/htmlsingle/#getting-started-native-build-tools

- This is definitely prefered way, the process should be: spring native
plugin produces special AOT sources and then another maven plugin from
graalvm compiles them to standalone executable.
- I had to build and use latest (0.11.0-RC1) plugin from the github
<https://github.com/spring-projects-experimental/spring-native/>
- I chose the entry point as gui/admin-gui module, so I needed to work with
the pom.xml there a bit + add the spring AOT plugin.
- Unfortunately I'm stuck on various errors, mostly NoClassDefFoundError

2. Running graalvm native-image directly. I'm not estimating that this
approach would produce usable midPoint as it skips spring AOT magic, but I
wanted to try.

- it fails with OOM (heap) after many hours of building, even with
ridiculously high Xmx:

root at midpoint:~/midpoint# CP=`find . -name *.jar | tr '\n' ':'`
root at midpoint:~/midpoint# native-image \
>   -Dspring.native.verbose=true \
>   -J-Xmx90G \
>   -H:Name=midPointNativeImage \
>   -H:+ReportExceptionStackTraces \
>   -Dspring.native.remove-unused-autoconfig=true \
>   -Dspring.native.remove-yaml-support=true \
>   -cp $CP \
>   -H:Class=com.evolveum.midpoint.web.boot.MidPointSpringApplication;
Fatal error:java.lang.OutOfMemoryError

M.

*Martin Lízner*
chief solution architect

gsm: [+420] 737 745 571
e‑mail: martin.lizner at ami.cz

*AMI Praha a.s.*
Pernerova 697/35, 186 00 Praha 8

tel.: [+420] 604 444 848 | web: www.ami.cz

[image: AMI Praha a.s.]

Textem tohoto e‑mailu podepisující neslibuje uzavřít ani neuzavírá
za společnost AMI Praha a.s.
jakoukoliv smlouvu. Každá smlouva, pokud bude uzavřena, musí mít výhradně
písemnou formu.

Tento e‑mail je určen výhradně pro potřeby jeho adresáta/ů a může obsahovat
důvěrné nebo osobní
informace. Nejste‑li zamýšleným příjemcem, je zakázáno jakékoliv
zveřejňování, zprostředkování
nebo jiné použití těchto informací. Pokud jste obdrželi e‑mail neoprávněně,
informujte o tom prosím
odesílatele a vymažte neprodleně všechny kopie tohoto e‑mailu včetně
všech jeho příloh. Nakládáním
s neoprávněně získanými informacemi se vystavujete riziku právního postihu.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20211125/1fd9101e/attachment.htm>


More information about the midPoint mailing list