Skip to content

Provide GraalVM native image support #1164

Closed
@sdeleuze

Description

@sdeleuze

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.

Activity

bnasslahsen

bnasslahsen commented on May 17, 2021

@bnasslahsen
Collaborator

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

sdeleuze commented on May 18, 2021

@sdeleuze
Author

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

bnasslahsen

bnasslahsen commented on May 23, 2021

@bnasslahsen
Collaborator

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

goafabric commented on Jul 10, 2021

@goafabric

@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 commented on Jul 26, 2021

@bnasslahsen
Collaborator

@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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @sdeleuze@goafabric@bnasslahsen

        Issue actions

          Provide GraalVM native image support · Issue #1164 · springdoc/springdoc-openapi