Context - https://stackoverflow.com/questions/79652217/very-slow-startup-time-for-spring-boot-executable-jar-on-windows-server-2016

I am not sure if this has been addressed already but could we have a configuration which would skip caching for jars in JarUrlConnection.java (basically mimic the behavior which was present in spring.boot.loader 3.1.x for windows server 2016) for future spring boot versions.

Comment From: wilkinsona

Thanks for the suggestion.

The question on Stack Overflow speculates that the cache "might be causing file locking in windows server 2016". File locking, if it resulted in contention, could slow things down, but I'm not sure that it would appear as increased CPU time in org.springframework.boot.loader.net.protocol.jar.JarFileUrlKey.get(URL) which is what the profiler seems to show.

Can you please explain in more detail why you believe that the cache is the cause of the problem?

Comment From: Shashwat7390

Hello,

At this point it's just a speculation but when I tried running the executable with an earlier version of spring boot i.e 3.1.x, this issue did not occur for me whereas in 3.3.x in which we currently are running the application we are facing it.

On comparing the source code for both the jars, it seems that the functionality to cache in JarFileUrlKey is not present in 3.1.x. but present in 3.3.x. So based on the profiler results I assumed the caching mechanism might be causing an issue.

This is very env specific. We are only seeing this in windows server 2016.

Comment From: wilkinsona

Unfortunately, we can't justify making a change for an env-specific problem when the cause is just speculation. Perhaps you could try making the change locally and gather some data about the performance with and without the cache?