Skip to content

braintelligencePL/spring-web-vs-spring-webflux

Repository files navigation

Spring Web vs Spring Webflux

Analyze performance of spring-boot-web and spring-boot-webflux


🏬 product-store: 8000 - slow service

We have some slow service that responds with 200ms delay. Lets assume that this service mimics some service accessed via HTTP. To better utilize hardware we have reactive stack here - webflux.

Run: ./gradlew -p product-store bootRun


🕰 spring-boot-web: 8010 - classical web service

Normal blocking web-service that fetches data from product-store.

Run: ./gradlew -p spring-boot-web bootRun


🧬 spring-boot-webflux: 8010 - reactive web service

Non-blocking, reactive web service that fetches data from product-store.

Run ./gradlew -p spring-boot-webflux bootRun


🏎 Performance Tests

Run ./gradlew -p performance-tests-gatling loadTest -D USERS=XXX -D REQUESTS_PER_USER=XXX



Results 👩‍🔬

Tests launched with:

  • MacBook Pro (15-inch, 2017)
  • 2,8 GHz Intel Core i7
  • 16 GB 2133 MHz LPDDR3
  • Radeon Pro 555 2 GB

Web - users at once 2_000. Each of them making 200 requests.

Simple and popular blocking code.

Run: ./gradlew -p performance-tests-gatling loadTest -D USERS=2000 -D REQUESTS_PER_USER=200


Webflux - users at once 2_000. Each of them making 200 requests.

More efficient, less popular and a bit more complex to implement.

Run: ./gradlew -p performance-tests-gatling loadTest -D USERS=2000 -D REQUESTS_PER_USER=200


Web - users at once 4_000. Each of them making 50 requests.

Run: ./gradlew -p performance-tests-gatling loadTest -D USERS=4000 -D REQUESTS_PER_USER=50


Webflux - Users at once 4_000. Each of them making 50 requests.

Run: ./gradlew -p performance-tests-gatling loadTest -D USERS=4000 -D REQUESTS_PER_USER=50


Web - users at once 4_000. Each of them making 100 requests.

Run: ./gradlew -p performance-tests-gatling loadTest -D USERS=4000 -D REQUESTS_PER_USER=100


Webflux - users at once 4_000. Each of them making 100 requests.

Run: ./gradlew -p performance-tests-gatling loadTest -D USERS=4000 -D REQUESTS_PER_USER=100


Summary:

Basically reactive stack performs requests twice that fast.

About

Web vs Webflux. Analyse performance with Gatling.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published