networknt / light-4j

A fast, lightweight and more productive microservices framework
Apache License 2.0
3.61k stars 633 forks source link

GraalVM Native Image #341

Closed archenroot closed 1 year ago

archenroot commented 5 years ago

Hi guys, have you tried already GraalVM native image compilation, it doesn't work with Spring for example well due to possibly lot of reflection usage which is not at moment still not fully supported by GraalVM, but maybe here is situation different.

miklish commented 5 years ago

Light uses reflection for its dependency injection system and third party tools such as Jackson do so as well when unmarshalling data into POJOs. So Light may run into issues similar to Spring, but some testing would be required to know for sure.

archenroot commented 5 years ago

@miklish - yeah, but it looks like Spring itself already did a lot of work here with success: https://jira.spring.io/browse/SPR-16991 Although springboot still not fully supported.

There are ways to provide reflection mapping via JSON file to GraalVM so it can proceed... I am not lucky on Gentoo as we don't have yet package to install, but there is Graal Docker image which can be used for games with native compilation. I will give it a try with light4j just to see... and will come back.

miklish commented 5 years ago

Thanks! I'm curious to see if it works (and also curious to see what causes the errors if it fails)

archenroot commented 5 years ago

I tested on other smaller frameworks and reflection is still issue, i did small test by providing static mapping which works on the other hand it could be some bigger work to make this working for whole think like light4j :-), eventually graalvm will support dynamic generation of mapping in future.

closing this for now.

stevehu commented 5 years ago

@archenroot Great insight on the topic. We will keep our eyes open as the development on this area is changing so fast. Thanks.

stevehu commented 5 years ago

There are a lot of requests from users these days and I think it is the time we take a look at the issue again.

This link provides a lot of info on this topic. https://royvanrijn.com/blog/2018/09/part-2-native-microservice-in-graalvm/

stevehu commented 5 years ago

In a process to learn GraalVM and explore various components in light-4j on GraalVM, I have created light-example-graal

stevehu commented 1 year ago

This has been done, and the example is in http-sidecar project.