Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reactor Netty is slower to start than Tomcat #376

Closed
sdeleuze opened this issue Jun 19, 2018 · 7 comments
Closed

Reactor Netty is slower to start than Tomcat #376

sdeleuze opened this issue Jun 19, 2018 · 7 comments
Labels
type/bug A general bug
Milestone

Comments

@sdeleuze
Copy link
Contributor

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()).

@violetagg
Copy link
Member

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

@sdeleuze
Copy link
Contributor Author

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

@smaldini smaldini added the status/need-investigation This needs more in-depth investigation label Jun 29, 2018
@smaldini smaldini added this to the 0.8.0.M1 milestone Jun 29, 2018
@violetagg violetagg added type/bug A general bug and removed status/need-investigation This needs more in-depth investigation labels Jul 5, 2018
@violetagg
Copy link
Member

@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)

@smaldini
Copy link
Contributor

smaldini commented Jul 6, 2018

Linked to #382

@sdeleuze
Copy link
Contributor Author

sdeleuze commented Jul 7, 2018

@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?

@violetagg
Copy link
Member

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)

@sdeleuze
Copy link
Contributor Author

Amazing, huge improvement!

@violetagg violetagg mentioned this issue Jul 26, 2018
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants