Reactor-netty: Reactor Netty is slower to start than Tomcat

Created on 19 Jun 2018  路  7Comments  路  Source: reactor/reactor-netty

This is not obvious with Spring Boot but Spring Fu minimal webapp benchmarks seems to indicate than Reactor Netty is slower to start than Tomcat.

Rector Netty:
Application started in 0.609 seconds (JVM running for 0.879)
Application started in 0.676 seconds (JVM running for 0.97)
Application started in 0.672 seconds (JVM running for 0.958)

Tomcat:
Application started in 0.440 seconds (JVM running for 0.709)
Application started in 0.440 seconds (JVM running for 0.723)
Application started in 0.445 seconds (JVM running for 0.72)

This should maybe be explored and optimized.

To run Spring Fu minimal webapp with Reactor Netty:

git clone https://github.com/spring-projects/spring-fu.git
./gradlew clean build
java -XX:TieredStopAtLevel=1 -noverify -jar target/demo-startup-kotlin-0.0.1-SNAPSHOT.jar

To use Tomcat, update samples/minimal-webapp/build.gradle.kts with:

dependencies {
    implementation(project(":modules:webflux-tomcat"))
    testImplementation(project(":modules:webflux-netty"))
    testImplementation(project(":modules:test"))
}

And Application.kt with server(tomcat()).

To use Undertow, update samples/minimal-webapp/build.gradle.kts with:

dependencies {
    implementation(project(":modules:webflux-undertow"))
    testImplementation(project(":modules:webflux-netty"))
    testImplementation(project(":modules:test"))
}

And Application.kt with server(undertow()).

typbug

All 7 comments

Is it correct that this is with Reactor Netty 0.7.x and not the current master?

Nope, this is using Reactor Netty 0.8.BUILD-SNAPSHOT builds since Spring Fu depends on Spring Framework 5.1 snapshots.

@sdeleuze Can you test #383. This fixes another issue but while I was investigating this one I saw that the fact that we start a thread might be related, so it will be great if you can provide us a feedback.

On my side I see

Reactor Netty (with the fix above):

Application started in 0.710 seconds (JVM running for 1.087)
Application started in 0.464 seconds (JVM running for 0.792)
Application started in 0.467 seconds (JVM running for 0.794)
Application started in 0.445 seconds (JVM running for 0.765)

Tomcat

Application started in 0.522 seconds (JVM running for 0.866)
Application started in 0.460 seconds (JVM running for 0.771)
Application started in 0.460 seconds (JVM running for 0.768)
Application started in 0.469 seconds (JVM running for 0.777)

Linked to #382

@violetagg I will be on PTO next week so I won't be able to do these test, but I suggest to test with 4.1.26.Final-SNAPSHOT as it fix the thread started in initializer issue. Also in your tests Reactor Netty is still significantly slower than Tomcat, right?

With the latest snapshot these are the measurements:

Reactor Netty

Application started in 0.293 seconds (JVM running for 0.608)
Application started in 0.294 seconds (JVM running for 0.599)
Application started in 0.286 seconds (JVM running for 0.591)
Application started in 0.289 seconds (JVM running for 0.596)

Tomcat

Application started in 0.443 seconds (JVM running for 0.735)
Application started in 0.443 seconds (JVM running for 0.74)
Application started in 0.443 seconds (JVM running for 0.741)
Application started in 0.447 seconds (JVM running for 0.742)

Amazing, huge improvement!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

philwebb picture philwebb  路  3Comments

vchekan picture vchekan  路  8Comments

phantomedc picture phantomedc  路  9Comments

violetagg picture violetagg  路  4Comments

hisener picture hisener  路  4Comments