Why is tomcat going to 200+ threads with Spring WebFlux?
Asked Answered
B

1

10

I am doing a POC with Spring WebFlux on Tomcat. The stack is totally reactive and using Spring Reactor and Reactive Couchbase.

When I added load on the System, I saw that the number of threads in JVisualVM increased to 200+. Basically, reactor-http threads were limited, about 4 as expected.

But http-nio-exec threads jumped to around 200. If I run with Netty instead of Tomcat the the number of threads is limited about 30 only.

Can some one explain why Tomcat is spinning up so many threads with a Reactive Stack?

Biggs answered 18/11, 2018 at 14:48 Comment(0)
S
8

Because netty has implemented an event loop mechanizm that alows for efficient handoff of incomming connections. Tomcat still uses model one thread per request.

This is a pretty intreting article on the issue:

https://kamilszymanski.github.io/resources-utilization-in-reactive-services/

Sortie answered 18/11, 2018 at 20:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.