Hi folks, I'm jumping in on the bandwagon again. Specifically to talk some more about native compilation. The graal compiler is making headway, and it's becoming better and better at native compilation [1].
I'll put some historical context at the bottom of this post for clarity. I have a few suggestions that I'd like some input on 1. Get rid of tomcat-embed-programmatic 2. Refactor existing graal JSON instructions [2] 3. Potentially introduce tomcat-embed-graal 4. Add in build feature flags to the code or code optimizations Today The amount of input we can provide to the graal compiler today, lets us work around many of the issues that were the reason for the tomcat-embed-programmatic. For example, graal can apply build time code substitution, like mentioned here [4]. We can also provide multiple JSON files [2], and effectively create profiles. So there can be an NIO profile, an NIO2 profile and an APR profile, if that's desired. Back to Proposal 1. Remove tomcat-embed-programmatic I believe this served its purpose. 2. Refactor existing graal JSON files This can allow us to create profiles with various memory footprints depending on functionality desired. 3. Potentially introduce tomcat-embed-graal This can have various code substitutions that we find beneficial. [4] 4. Add in build feature flags to the code or code optimizations graal can still do static analysis to optimize inclusion of code paths. as demonstrated in this example [5]. As this seems to pollute our codebase with graal specific stuff when it could have been done as a substitution, I'm still presenting it to gather more opinions. Filip Historical Context When we created tomcat-embed-programmatic, we did so to reduce the memory footprint[3] of the simplest tomcat installation. At the time, the graal compiler was indiscriminate and would absorb virtually any class file in a library. So we created an experimental jar, tomcat-embed-programmatic, that was reduced to be embedded, no resource files, no XML support, and removed the reflection property setters for configurable components. References [1] https://github.com/spring-projects-experimental/spring-native/issues/1426 [2] https://github.com/apache/tomcat/tree/main/res/graal/tomcat-embed-core/native-image [3] https://github.com/spring-projects-experimental/spring-native/issues/1426#issuecomment-1019546681 [4] https://github.com/spring-projects-experimental/spring-native/issues/1426#issue-1095362633 [5] https://github.com/spring-projects-experimental/spring-native/issues/1426#issuecomment-1072581363