Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide GraalVM native image support #1164

Closed
sdeleuze opened this issue May 17, 2021 · 5 comments
Closed

Provide GraalVM native image support #1164

sdeleuze opened this issue May 17, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@sdeleuze
Copy link

sdeleuze commented May 17, 2021

We don't provide such support directly on Spring Native side because we only support what supported on start.spring.io, but I will be happy to provide some guidance and help if somebody is interested to contribute it here.

@bnasslahsen
Copy link
Contributor

bnasslahsen commented May 17, 2021

Hi @sdeleuze,

I confirm WIP to have GraalVM fully supported together with spring-native.

It should be working, out of the box without any additional configuration starting from the next release v1.5.9!

The main missing piece is related to oracle/graal#1108 or spring-attic/spring-native#157, but i added workaround for it 60e458e.

I will add a simple demos project that will be available soon using the latest SNAPSHOT.

@sdeleuze
Copy link
Author

sdeleuze commented May 18, 2021

Amazing, I will mention Springdoc in Spring Native documentation when released.

@bnasslahsen
Copy link
Contributor

Hi @sdeleuze,

I confirm, that release springdoc-openapi v1.5.9 is now released.

There is huge improvement of load time during the first and second access to the swagger-ui.

The improvement is just impressive with the native image on many levels.
The springdoc demos applications, has been built using paketobuildpacks/builder:tiny, with the default configuration (no optimization).

VM characteristics:

Component characteristics
CPU(Intel) 2 OCPU
Memory 8 GB

Components versions:

Component Version
spring-boot 2.5.0
spring-native 0.9.2

springdoc-openapi-spring-boot-2-webflux demo results:

Native
Image
JVM Startup time
(sec)
swagger-ui
Tweets-API
1st run (ms)
swagger-ui
Stream-API
2nd run (ms)
Image
Size
(MB)
Memory
Usage
(MB)
CPU
Usage
(%)
No Hotspot 1.8.0_292 2.603 183 19 240 527 4
Yes GraalVM 21.0.0.2 0.084 8 3 224 132 0.8

springdoc-openapi-spring-boot-2-webmvc demo results:

Native
Image
JVM Startup time
(sec)
swagger-ui
Users-API
1st run (ms)
swagger-ui
Stores-API
2nd run (ms)
Image
Size
(MB)
Memory
Usage
(MB)
CPU
Usage
(%)
No Hotspot 1.8.0_292 2.569 416 39 238 481 5
Yes GraalVM 21.0.0.2 0.13 38 9 214 126 0.7

@goafabric
Copy link

@bnasslahsen
Thanks for your support .. i barely missed this post .. and up to know i did not know that there are two OpenApi Implementations for Spring (Springfox is the one I knew)

I tried version 1.5.9 with the latest Spring Native 0.10.1 ... unfortunately its not working out of the box.
The code Compiles and i can access the OpenAPI page .. but it than throws one of those dreaded
NativeHint Exceptions ...
Indication missing Nativehints on RestController and SynthesizedAnntation .. even setting this does not resolve the issue.

Is there anything special that has to be adjusted here ? The Demo Example e.g. excludes the health endpoint

thx

@bnasslahsen bnasslahsen reopened this Jul 13, 2021
@bnasslahsen
Copy link
Contributor

@goafabric,

As mentioned in the previous post, the demo was validated with:

Component Version
spring-boot 2.5.0
spring-native 0.9.2

For the support for newer versions which, it's better to create a separate enhancement request. (I have now created #1225)

@bnasslahsen bnasslahsen added the enhancement New feature or request label Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants