spring-projects / spring-boot

Spring Boot helps you to create Spring-powered, production-grade applications and services with absolute minimum fuss.
https://spring.io/projects/spring-boot
Apache License 2.0
75.06k stars 40.66k forks source link

Gather @Condition performance metrics #7939

Open philwebb opened 7 years ago

philwebb commented 7 years ago

We could do with knowing which conditions are slow/fast so we can optimize.

wilkinsona commented 7 years ago

Some preliminary timings:

1.5 Actuator sample jar:

Condition Time (ms)
CacheCondition 0.842495
DefaultDispatcherServletCondition 0.522723
DispatcherServletRegistrationCondition 3.09485
EmbeddedDatabaseCondition 1.769343
ErrorTemplateMissingCondition 9.902529
GitResourceAvailableCondition 0.291634
JmxEnabledCondition 2.346582
LogFileCondition 0.286643
MailSenderCondition 1.339892
OnBeanCondition 164.222704
OnClassCondition 35.069383
OnCloudPlatformCondition 0.09293
OnEnabledEndpointCondition 1.43508
OnEnabledHealthIndicatorCondition 3.402162
OnEnabledInfoContributorCondition 0.677727
OnEnabledResourceChainCondition 1.701722
OnJavaCondition 0.857914
OnManagementMvcCondition 1.461866
OnPropertyCondition 9.097541
OnResourceCondition 0.814681
OnValidatorAvailableCondition 72.347993
OnWebApplicationCondition 1.02135
PooledDataSourceCondition 10.150408
ResourceBundleCondition 0.847989
WebSecurityEnablerCondition 0.0882

1.5 Freemarker sample jar

Condition Time (ms)
CacheCondition 1.083238
DefaultDispatcherServletCondition 0.836775
DispatcherServletRegistrationCondition 2.849338
ErrorTemplateMissingCondition 6.467199
GitResourceAvailableCondition 0.282914
OnBeanCondition 91.857201
OnClassCondition 18.029774
OnEnabledResourceChainCondition 2.744087
OnJavaCondition 0.712423
OnPropertyCondition 5.957752
OnResourceCondition 0.728593
OnValidatorAvailableCondition 133.835755
OnWebApplicationCondition 0.886211
ResourceBundleCondition 0.805604
philwebb commented 7 years ago

I knew about OnBeanCondition and I think we'll need some framework changes and help from @jhoeller to fix that one. The OnValidatorAvailableCondition is pretty amazing, especially as it's used just once!

philwebb commented 7 years ago

I've raised #8110 to look at the validator one.