-
Notifications
You must be signed in to change notification settings - Fork 630
Closed
Description
We noticed longer startup times after upgrading to Spring-Boot 3.4.0 and Spring Cloud Stream 4.2.0.
Spring-Boot 3.3.8 & Spring Cloud Stream 4.1.4
2025-02-05T09:55:47.778-05:00 INFO 37245 --- [ restartedMain] o.s.c.s.binder.DefaultBinderFactory : Creating binder: undefined
2025-02-05T09:55:47.779-05:00 INFO 37245 --- [ restartedMain] o.s.c.s.binder.DefaultBinderFactory : Constructing binder child context for undefined
2025-02-05T09:55:47.789-05:00 DEBUG 37245 --- [ restartedMain] c.s.c.c.e.l.BinderEventPropagator : Publishing event com.solace.connector.core.event.BinderContextInitializedEvent[binderName=undefined, source=undefined_context, started on Wed Feb 05 09:55:47 EST 2025, parent: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@14f807c3]
2025-02-05T09:55:47.789-05:00 TRACE 37245 --- [ restartedMain] c.s.c.c.e.listener.StartupEventListener : Received binder context initialized event for binder: undefined
2025-02-05T09:55:47.789-05:00 INFO 37245 --- [ restartedMain] o.s.c.s.binder.DefaultBinderFactory : Caching the binder: undefined
Spring-Boot 3.4.0 & Spring Cloud Stream 4.2.0
2025-02-05T09:37:10.626-05:00 INFO 34207 --- [ restartedMain] o.s.c.s.binder.DefaultBinderFactory : Creating binder: undefined
2025-02-05T09:37:10.626-05:00 INFO 34207 --- [ restartedMain] o.s.c.s.binder.DefaultBinderFactory : Constructing binder child context for undefined
2025-02-05T09:37:11.218-05:00 DEBUG 34207 --- [ restartedMain] c.s.c.c.e.l.BinderEventPropagator : Publishing event com.solace.connector.core.event.BinderContextInitializedEvent[binderName=undefined, source=undefined_context, started on Wed Feb 05 09:37:10 EST 2025, parent: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@7f447734]
2025-02-05T09:37:11.218-05:00 TRACE 34207 --- [ restartedMain] c.s.c.c.e.listener.StartupEventListener : Received binder context initialized event for binder: undefined
2025-02-05T09:37:11.218-05:00 INFO 34207 --- [ restartedMain] o.s.c.s.binder.DefaultBinderFactory : Caching the binder: undefined
Note the difference for Constructing binder child context for undefined of >500ms.
Note that the undefined binder is a dummy binder that does nothing. Therefore, there is no connection related costs in the above.
Spring-Boot Change
We have identified the specific Spring Boot commit responsible for the slower startup times.
Slower Spring Cloud Stream Operations
We also identified which operations have become more expansive.
- This binderProducingContext.refresh() has become significantly more expensive.
- Also, we have initialization logic which makes multiple calls to
bindingServiceProperties.getBinder(binding)and have observed that when the binding is a producer binding, the getBinder() call takes~4msinstead of0ms. CallinggetBinder(binding)on a consumer binding is still fast and takes 0ms.
Summary
A recent Spring-Boot change to child/parent contexts slows down startup. Can you tell how the change may be affecting Spring Cloud Stream?