A simple introduction

In Spring Boot 2.2, however, there have been significant optimizations for performance. Applications will start faster and use less memory. Well, LET me test that with a project that’s already running online.

According to the brief description of the project, the original Spring Boot version is 2.1.3, and we plan to upgrade to 2.2.7. Of course, just upgrade the version and change the port number, nothing else. The container is Undertow.

The startup time

2.1.3. RELEASE

Started SyncApplication in11.747 seconds (JVM is runningfor 12.292)
Copy the code

2.2.7. RELEASE

Started SyncApplication in11.955 seconds (JVM is runningfor 12.577)
Copy the code

conclusion

Without changing the configuration, the startup time did not change. Compared with the three startup records, 2.1.3.RELEASE was actually faster. Spring Boot 2.2 adds a global lazy initialization parameter, spring.main.lazy-initialization, to speed up application startup.

Started SyncApplication in13.123 seconds (JVM is runningfor 13.783)
Copy the code

Minimum memory after startup [after GC]

2.1.3. RELEASE

Used: 47.7MB Submitted: 1.1GB Active Threads: 34 Threads Peak: 37 Loaded Classes: 15511Copy the code

2.2.7. RELEASE

Used: 37.4MB Submitted: 1.6GB Active Threads: 33 Threads Peak: 35 Loaded Classes: 15519Copy the code

conclusion

2.2.7. The initial memory occupation of RELEASE was still relatively small, but after startup, it expanded rapidly and the number of threads was also much smaller. 2.1.3.RELEASE application memory grows in a small gradient.

A simple test

2.1.3. RELEASE

Running 20s test100 connections @ http://127.0.0.1:9801/sync/welcome 4 threads and Thread Stats Avg Stdev Max + / - Stdev Latency 24.42 ms 19.71ms 261.02ms 67.57%req /Sec 1.09k 320.91K 68.72% Latency Distribution 50% 11.95ms 75% 44.17ms 90% 46.44ms 99% 86.46 ms 86984 requestsin20.05 s, 13.27 MBread
Requests/sec:   4337.66
Transfer/sec:    677.76KB
Copy the code

2.2.7. RELEASE

Running 20s test100 connections @ http://127.0.0.1:9802/sync/welcome 4 threads and Thread Stats Avg Stdev Max + / - Stdev Latency 22.23 ms 16.77ms 176.80ms 66.22% Req/Sec 1.20k 348.48 1.828K 66.71% Latency Distribution 50% 13.22ms 75% 36.49ms 90% 44.61ms 99% 72.03 ms 95815 requestsin20.05 s, 14.62 MBread
Requests/sec:   4778.59
Transfer/sec:    746.65KB
Copy the code

conclusion

The QPS of 2.2.7.RELEASE was higher than that of 2.1.3.RELEASE, but it had no advantage in terms of less memory usage. In addition, during the warm-up, 2.2.7.RELEASE was found to have CPU surge, and the subsequent test returned to normal.

inductive

The new version of Spring Boot is still good, in the industry, Spring stability and reliability is trustworthy, hopefully better and better.