According to dubbo documentat" /> According to dubbo documentat" /> According to dubbo documentat"/>

Does dubbo thread model init the fixed number of threads at start time?

181 views Asked by At

A part of my dubbo configuration file:

<dubbo:protocol name="dubbo" dispatcher="all" threadpool="fixed" threads="100" />

According to dubbo documentation the config above means

A fixed size of thread pool and it creates threads when starts, never shut down.

But when I started the application then I use jstack to see if there are more than 100 threads, I found only about 40 threads and I didn't find any dubbo threads. So, what happened?

2

There are 2 answers

1
Karol Dowbecki On

The thread pool that you create by declaring dubbo:protocol is not the only source of threads in the JVM. Normally JVM starts a number of utility threads so it can function properly and support various features e.g. finalizers, shutdown hooks, RMI, etc. jstack shows the thread names, most of them you should be able to google and understand their purpose.

Your dubbo thread pool will most likely spawn new threads only when handling the incoming requests.

0
jenksding On

Here's dubbo thread model(http://dubbo.apache.org/en-us/docs/user/demos/thread-model.html),there is a picture demonstrating dubbo thread model,you can see that only server has a thread pool,which means only dubbo provider has thread pool.because it needs to separate I/O thread from non I/O thread.