Closed moarychan closed 2 years ago
Support adding spring native capability for Spring Cloud Azure libraries in Spring Initializr Spring developers can add Azure Support, Spring Native, Azure Native Support, in Spring Initializr, then the application can be built to a native executable or a container containing a native executable.
About the experience on Spring Initializr, I don' think we need a Azure Native Support in spring initialize. But we need to make sure when a user chooses "Spring Native" and "Azure Support", the generated pom is correctly confined.
Since by choose above two dependencies, it is clearly meaning that the user wants to
Spring Initializr is scenario based, we don't want to break this experience
@moarychan here is my thoughts of the goal of this feature
close in #28158
Add a perf data reference, it's tested through Spring Cloud Azure Starter Blob and Azure Storage Blob Emulator:
Env info: Windows 11, i5-1135G7 @ 2.4GHz, 16G; Jdk 11.0.15; Graal VM CE-Java11-22.0.0.2; Azure Storage Blob Emulator; Spring Boot 2.6.6; Spring Native 0.11.4; Spring Cloud Azure Starter Storage Blob 4.1.0;
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
BOOT + REST for first Response Memory (Seconds) | | | -- | -- | -- | -- Tech stack | BOOT | REST | REST to write and read with Storage Blob Spring Web + Spring Cloud Azure Storage Blob + JVM | 2.551 Seconds | 0.101 Seconds | 1.108 Seconds Spring Web + Spring Cloud Azure Storage Blob + Spring Native + Graal VM | 0.297 Seconds | 0.009 Seconds | 0.274 Seconds | | | BOOT + REST First Response Time (Megabytes) | | | Tech stack | BOOT | REST | REST to write and read with Storage Blob Spring Web + Spring Cloud Azure Storage Blob + JVM | 258 M | 271 M | 326 M Spring Web + Spring Cloud Azure Storage Blob + Spring Native + Graal VM | 33 M | 33 M | 41 M
Context
More and more Spring Boot applications are pursuing an instant startup, instant peak performance, and reduced memory consumption. The Spring team has also helped to provide the Spring Native framework, and it will be officially GA soon, it is necessary for us to support Spring Native for all Spring Cloud Azure libraries.
The Azure SDK level is ready to support the Graal VM native image compiler, although it has not released any version. But there is no available solution for Spring Cloud Azure users to build Native Image when using Spring Cloud Azure libraries. And some Spring Cloud Azure users have proposed to build applications based on Spring Native: https://github.com/Azure/azure-sdk-for-java/issues/20489.
Goal
Based on JDK 11, the latest Spring Native (the current version is 0.11.3), and Graal VM SDK (The current version is 22.0.0.2) versions, the beta version should be provided as early as possible to support. Include the following:
azure-aot-graalvm-support
to enable the native image compilation in Azure SDK level.spring-cloud-azure-native-configuration
, which targets the compilation in the Spring Cloud Azure level, it will combine the dependencyspring-native
to compile a native image based on Spring Cloud Azure application.spring-cloud-azure-starter-storage-blob
,spring-cloud-azure-native-configuration
, andspring-native
, and generate a native executable or a container containing a native executable.Azure Support
,Spring Native
,Azure Native Support
, in Spring Initializr, then the application can be built to a native executable or a container containing a native executable.Solution
Spring Cloud Azure libraries will follow the Spring Native pattern to build a native executable image, a configuration module called
spring-cloud-azure-native-configuration
is added to find out the additional configuration for Spring Cloud Azure level, this module is required to combine the dependencySpring Native
to build a native image. It needs to meet the following requirements:@NativeHint
to configure all classes that need to be explicitly declared.