Description
Affects: 6.0.10 (Spring Boot 3.1.1)
Summary:
After upgrade to Spring Boot 3.x application started to take more time for web requests processing.
Description:
Initially, the application was based on Spring Boot 2.7.14 (Java 17). But since we upgraded to Spring Boot 3.1.1 we noticed performance degradation in web layer. Requests processing took extra time in comparison with Boot 2.x. Upgrade to Spring Boot 3.1.2 made it ever worse. Tomcat's MessageBytes
serialization started to perform even slower. So we reverted to Spring Boot 3.1.1.
One more thing that was discovered in the profiler is slow performance of AntMatcher
. So we followed the recommendation from upgrade guide of Spring Boot 2.6 and witched to PathParser
. As it turns out, this did not make much of an improvement (see details below).
CPU
Here are some details captured using DataDog profiler.
Here is a request processing of the URL that has path variables:
And here is a request processing of the URL that has no path variables:
Memory
One more thing that was discovered is memory consumption, most of the allocations are happening here:
How can this be improved? One thought is around some kind of caching for PathParser
to avoid extra calculations while request matching.