Hi,
During some evaluation tests of the smack 4.1.x library I encountered a very high number of threads that are created per connection. I was aware that previous versions used 4 threads per connection but this seems to have changed with the new version.
I ran some tests that create connections and log the number of threads used within the JVM (ManagementFactory.getThreadMXBean().getThreadCount()). Here are the results.
1 connections - 11 threads
2 connections - 17 threads
3 connections - 23 threads
4 connections - 29 threads
5 connections - 35 threads
6 connections - 41 threads
7 connections - 47 threads
8 connections - 53 threads
9 connections - 59 threads
10 connections - 65 threads
11 connections - 71 threads
12 connections - 77 threads
13 connections - 83 threads
14 connections - 89 threads
15 connections - 95 threads
16 connections - 101 threads
17 connections - 107 threads
18 connections - 113 threads
19 connections - 119 threads
20 connections - 125 threads
When adding the smack-extensions artifact to my project the situation is getting even worse.
1 connections - 13 threads
2 connections - 22 threads
3 connections - 34 threads
4 connections - 49 threads
5 connections - 64 threads
6 connections - 76 threads
7 connections - 88 threads
8 connections - 99 threads
9 connections - 110 threads
10 connections - 121 threads
11 connections - 133 threads
12 connections - 143 threads
13 connections - 152 threads
14 connections - 164 threads
15 connections - 179 threads
16 connections - 190 threads
17 connections - 200 threads
18 connections - 211 threads
19 connections - 222 threads
20 connections - 233 threads
So it seems that a connection requires at least 10 threads. When having a look on the names of the threads I saw that most of them are some thread pools. Are they really instantiated for every connection? I expected some sharing among the connections of these pools.
Thanks,
Ingo