The target

  • 50, 100, 200, 300 Concurrently test Spring WebFlux and Spring MVC applications respectively
  • Summarize the advantages of Spring WebFlux compared with Spring MVC

The preparatory work

  • Prepare a project based on Spring WebFlux and a Spring MVC project
  • Apache-jmeter-3.3.2: Pressure measuring tool
  • JvisualVM: JVM metrics monitoring

Began to pressure measurement

Indicator 1:50 concurrent, pressure measurement for 1 minute

  • Spring MVC

    • Jmeter pressure test report

    • The JVM monitoring

  • Spring WebFlux

    • Jmeter pressure test report

    • The JVM monitoring


Indicator 2:100 concurrent, pressure test for 1 minute

  • Spring MVC

    • Jmeter pressure test report

    • The JVM monitoring

  • Spring WebFlux

    • Jmeter pressure test report

    • The JVM monitoring


Indicator 3:200 concurrent, pressure test for 1 minute

  • Spring MVC

    • Jmeter pressure test report

    • The JVM monitoring

  • Spring WebFlux

    • Jmeter pressure test report

    • The JVM monitoring


Indicator 4:300 concurrent, pressure measurement for 1 minute

  • Spring MVC

    • Jmeter pressure test report

    • The JVM monitoring

  • Spring WebFlux

    • Jmeter pressure test report

    • The JVM monitoring

conclusion

Spring WebFlux pressure measurement data statistics

indicators The total number of requests TPS Maximum response time Minimum response time Mean response time Maximum heap size CPU Max Thread Number
50 Concurrency/minute 1946711 32445.2 169 0 1 About 310 m About 44% 20
100 concurrency/minute 1891256 31519.9 247 0 3 About 310 m About 46% 19
200 Concurrency/minute 1920013 31995.4 285 0 6 About 280 m About 45% 20
300 concurrency/minute 1875748 31255.2 803 0 9 About 410 m About 45% 19

Spring MVC pressure test data statistics

indicators The total number of requests TPS Maximum response time Minimum response time Mean response time Maximum heap size CPU Max Thread Number
50 Concurrency/minute 1431685 23860.6 637 0 2 About 700 m About 42% Up to 120
100 concurrency/minute 1412411 23537.4 164 0 4 About 400 m About 42% Up to 125
200 Concurrency/minute 1399163 23314.3 234 0 8 Around 400, About 45% Up to 216
300 concurrency/minute 1332564 22206.8 235 0 13 The maximum is 1.5GB or more About 41% Up to 217

conclusion

Four pressure tests without any parameter tuning showed better Spring WebFlux performance, more requests per unit time, higher TPS (much higher, up by over 35%), and better memory usage and thread resources. The number of threads that Spring WebFlux processes tasks in the four pressure tests is almost unchanged, only a few dozen, and the higher the concurrency of Spring MVC is, the more task threads will be created, which all benefit from the Netty+Reactor asynchronous non-blocking pattern used by Spring WebFlux.