WebFlux vs. Blocking (MVC): Performance

Analyze the performance of the reactive approach (Spring WebFlux) and the blocking approach (Spring MVC).

Different test configurations

Interestingly enough, implementing a full reactive web stack introduces some extra delay in the total time required to retrieve a response from the server. This is due to the extra processing needed to make the communication work. Therefore, we can’t extract conclusions by looking at the requests one by one.

The reactive web approach shines when we measure the whole performance of the server handling multiple requests at the same time. In this section, we’ll go through different test configuration options, and we’ll see the results in graphs that compare the WebFlux implementation to the Web MVC one.

The results come from a benchmark test that you can run yourself. In the GitHub backend’s project folder, spring-boot-reactive-web, you’ll find the BenchmarkTest test class. Remove the @Ignore annotation and run the tests or just use your IDE to execute it.

Get hands-on with 1400+ tech skills courses.