Analyze performance of spring-boot-web
and spring-boot-webflux
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
Normal blocking web-service that fetches data from product-store.
Run: ./gradlew -p spring-boot-web bootRun
Non-blocking, reactive web service that fetches data from product-store.
Run ./gradlew -p spring-boot-webflux bootRun
Run ./gradlew -p performance-tests-gatling loadTest -D USERS=XXX -D REQUESTS_PER_USER=XXX
Tests launched with:
- MacBook Pro (15-inch, 2017)
- 2,8 GHz Intel Core i7
- 16 GB 2133 MHz LPDDR3
- Radeon Pro 555 2 GB
Simple and popular blocking code.
Run: ./gradlew -p performance-tests-gatling loadTest -D USERS=2000 -D REQUESTS_PER_USER=200
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
Run: ./gradlew -p performance-tests-gatling loadTest -D USERS=4000 -D REQUESTS_PER_USER=50
Run: ./gradlew -p performance-tests-gatling loadTest -D USERS=4000 -D REQUESTS_PER_USER=50
Run: ./gradlew -p performance-tests-gatling loadTest -D USERS=4000 -D REQUESTS_PER_USER=100
Run: ./gradlew -p performance-tests-gatling loadTest -D USERS=4000 -D REQUESTS_PER_USER=100
Basically reactive stack performs requests twice that fast.