-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
In what version(s) of Spring Integration are you seeing this issue?
6.5.1
Describe the bug
We've been looking into ways to improve our app's messaging throughput in high throughput messaging scenarios.
One thing we've tested out and noticed was that MessageProducerSupport.sendMessage()
always creates observability overhead (calling IntegrationObservation.HANDLER
) even when ObservationRegistry.NOOP
is configured. This seems to result in a performance impact of roughly 15-25% or so in very high throughput messaging scenarios.
To Reproduce
Just run messages as fast as possible through MessageProducerSupport
with NOOP observability configured (the default), and watch the throughput.
Expected behavior
When ObservationRegistry.NOOP
is configured, observability overhead should be eliminated entirely. The method should detect NOOP registry and bypass observability infrastructure for optimal performance.
One potential solution to this is to add a simple check in MessageProducerSupport.sendMessage()
:
if (this.observationRegistry.isNoop()) {
this.messagingTemplate.send(getRequiredOutputChannel(), trackMessageIfAny(message)); // Direct send
} else {
// existing observability path
}
See this commit for an actual example fix: Nephery@fbb541a
Sample
- Clone repository: https://github.com/Nephery/spring-integration-noop-observability-perf
- Follow the setup instructions to install the spring integration fork.
- Follow these instructions to run the test twice; once with the current spring integration version, and once more with the bypass solution.
- Compare the test results between the regular and optimized runs, and notice that the optimized run is a bit better.
- From running this on my personal computer, these are the results I got with roughly a 18% performance increase.
Note: When using this NOOP observability bypass in one of our actual apps, we see similar relative performance gains in these very high throughput scenarios.