safarione
safarione

Reputation: 115

Where are the "I/O dispatcher" threads coming from in WebFlux (Netty) or MVC (Tomcat-NIO) Application?

I have 2 Spring Boot Applications, one WebFlux on Netty and one MVC on Tomcat. I know the apps use the following threads: WebFlux (Netty):

reactor-netty-nio-*

MVC (Tomcat-NIO):

http-nio-8091-exec-*

But both Applications also create a number of I/O dispatcher threads, according to the number of logical cores. Can somebody help me understand where they are coming from?

WebFlux Netty

MVC Tomcat

Upvotes: 3

Views: 1132

Answers (1)

jwpol
jwpol

Reputation: 1485

The easiest way to check is to do the thread dump in VisualVM: VisualVM_Thread_Dump

I see:

"I/O dispatcher 5" #30 prio=5 os_prio=31 cpu=1.32ms elapsed=32.11s tid=0x00000001150f7200 nid=0x9503 runnable  [0x0000000172ee6000]
   java.lang.Thread.State: RUNNABLE
        at sun.nio.ch.KQueue.poll([email protected]/Native Method)
        at sun.nio.ch.KQueueSelectorImpl.doSelect([email protected]/KQueueSelectorImpl.java:122)
        at sun.nio.ch.SelectorImpl.lockAndDoSelect([email protected]/SelectorImpl.java:129)
        - locked <0x00000005c29ccc58> (a sun.nio.ch.Util$2)
        - locked <0x00000005c29ccc00> (a sun.nio.ch.KQueueSelectorImpl)
        at sun.nio.ch.SelectorImpl.select([email protected]/SelectorImpl.java:141)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:255)
        at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
        at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591)
        at java.lang.Thread.run([email protected]/Thread.java:840)

I/O Dispatcher threads are spawned by Apache HTTP. I have spring cloud-related dependencies

Upvotes: 0

Related Questions