Steve Saliman
Steve Saliman

Reputation: 143

Performance issues with Spring Boot 2.x?

I recently updated the version of Spring Boot used in a web application from version 1.5 to 2.1. When I ran the load tests against it, my run times went from 25 minutes to 35 minutes.

I know it is a broad question, but does anyone have any clues as to why the application would slow down so dramatically after upgrading the Spring Boot libraries?

EDIT: After spending a lot of time trying to understand profiler ouput, The problem appears to be in the communication to the database. The Mariadb JDBC driver calls java.io.FilterInputStream.read to get data back from the database. According to the profiler, the application spends nearly twice as long in this method when running in Spring Boot 2 as it did in Spring Boot 1 (using Hikari for both). Same application. Same Database. Same mariadb drivers. Only the version of Spring changed, and whatever Spring brought in (like tomcat 9 instead of 8, or hibernate 5.3 instead of hibernate 5.0)

EDIT #2: I've done some more testing. I ran Spring Boot 2.1 with a downgraded Tomcat (8.5.37), and the performance remained bad, so it would seem that Tomcat is not the issue. Next, I ran Spring Boot 1.5 with an upgraded Hibernate (5.3.10), and performance remained good, so it would seem that Hibernate isn't the issue either. That doesn't leave much other than spring boot itself, and it remains a complete mystery to me why a class in java.io would take longer under one framework than another.

This is preventing me from moving forward Spring Boot updates to production, so I appreciate any pointers you have,

Steve

Upvotes: 2

Views: 3967

Answers (2)

Azad Singh Kalakoti
Azad Singh Kalakoti

Reputation: 1

This may not be the perfect answer.

But just an observation: Spring boot 2(2.1.4 to 2.1.7) definitely has performance issues if compared against version 1(1.59).

We ran JMeter tests for 8 hrs, hitting 100-150 tps, which sustained the load in both the versions, but average response time increased by almost 50-70ms and lots of spikes were there.

The versions lower than 2.1.4(2.1.3 has slightly better performance but not the best.

1 >> 2.1.3 > 2.1.7

Upvotes: 0

evernat
evernat

Reputation: 1743

Performance regressions may come from a lot of causes. So I suggest to include the javamelody-spring-boot-starter in your application.

That way you may find the performance regressions among the longest http or sql requests.

And perhaps more important, you may find which http and sql requests should be improved for overall performance, according to statistics during load tests or in production.

Upvotes: 1

Related Questions