spring-projects / spring-boot

Spring Boot

Home Page:https://spring.io/projects/spring-boot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Optimize startup time: cache configuration

dsyer opened this issue · comments

The Pet Clinic depends on EhCache, but it doesn't even use it unless the "production" profile is enabled. And yet it costs a couple hundred ms apparently (see benchmarks at https://github.com/dsyer/spring-boot-startup-bench). This might be just a special case of too much condition processing on startup, but I did notice that all cache types are configured in CacheConfigurationImportSelector, even if they are switched off by condition processing, and maybe this is unnecessary.

I noticed that too and we should revisit the condition to back-off sooner indeed. If you have an app with nothing particular on the classpath, the cache conditions always shows up which is not nice at all.

@dsyer I know you've been looking at pet clinic again recently. Did this issue end up being a quirk of the report (#13509) or was it legit? What are the steps we need to follow to replicate?

Some analysis: spring-attic/spring-init#5. The benchmark code is there as well I think (in the petclinic sample inside that project). See also this Spring Framework issue: spring-projects/spring-framework#22175.