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?
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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With