Impact of CoreEnvironment Static Block on Serverless Applications

Hi Michael,

I rerun the code again in Springboot 3 with some random libraries just to see how it perform compared to our in-house reactive framework built on top of Vertx. It did take 350ms to run create ClusterEnvironment with builder on my decent specs laptop especially with medium size fat jar. This is kinda misleading because we all expect the builder to execute almost instantly.

To reproduce this issue, we can run this code as part of any standalone executable fat jar. The key observation here is that the more 3rd party jar files included in the final fat jar, the longer it take to scan all the jar files (in this case Spring Boot, I’ll retry with Vertx)

Here’s the code I used for this Spring boot testing. It would be interesting to compare how it performs in your environment.

When you try it, kindly execute as a standalone jar file (java -jar) instead of using IDE like InteliJ/Eclipse

2024-08-05T20:35:26.947-04:00 INFO 37636 — [ main] com.example.demo.DemoApplication : Creating ClusterEnvironment
2024-08-05T20:35:27.250-04:00 INFO 37636 — [ main] com.example.demo.DemoApplication : ClusterEnvironment created

Thanks