You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/user-manual/thread-pooling.adoc
+58-7Lines changed: 58 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -110,17 +110,68 @@ in-vm connectivity and invoking failure listeners for Netty
110
110
`Log4j2-TF-\*-Scheduled-*`::
111
111
executes Log4j2 tasks related to `CronTriggeringPolicy` used by default `log4j2.properties`
112
112
113
-
114
113
== Client-Side Thread Management
115
114
116
-
On the client side, the Core client maintains a single, "global" static scheduled thread pool and a single, "global" static general thread pool for use by all clients using the same classloader in that JVM instance.
115
+
On the Core client thread pools exist for each of the following:
117
116
118
-
The static scheduled thread pool has a maximum size of `5` threads by default.
119
-
This can be changed using the `scheduledThreadPoolMaxSize` URI parameter.
117
+
* scheduled tasks
118
+
* general use
119
+
* flow control
120
+
* remoting (managed by Netty on a per-connector basis)
120
121
121
-
The general purpose thread pool has an unbounded maximum size.
122
-
This is changed using the `threadPoolMaxSize` URL parameter.
122
+
These are used by all clients using the same classloader in a JVM.
123
123
124
-
If required the Core client can also be configured so that each `ClientSessionFactory` instance does not use these "global" static pools but instead maintains its own scheduled and general purpose pool.
124
+
If required each `ClientSessionFactory` instance can be configured so that it does not use these global static pools but instead maintains individual pools.
125
125
Any sessions created from that `ClientSessionFactory` will use those pools instead.
126
126
This is configured using the `useGlobalPools` boolean URL parameter.
127
+
The default is `true`.
128
+
129
+
=== Scheduled Thread Pool
130
+
131
+
The scheduled thread pool is used for activities that require running periodically or with delays.
132
+
This includes tasks like:
133
+
134
+
* sending `PING` packets to the broker
135
+
* flushing network data to the wire if `batchDelay` > `0`
136
+
137
+
The maximum number of threads used by this pool can be configured using the `scheduledThreadPoolMaxSize` URI parameter, e.g.:
138
+
139
+
----
140
+
tcp://host:61616?scheduledThreadPoolMaxSize=10
141
+
----
142
+
143
+
The Java system property `activemq.artemis.client.global.scheduled.thread.pool.core.size` can also be used.
144
+
145
+
The default `scheduledThreadPoolMaxSize` is `5`.
146
+
A value of `0` is not allowed.
147
+
148
+
If using a global pool the name for threads will contain `activemq-client-global-scheduled`.
149
+
If using a non-global pool the name for threads will contain `activemq-client-factory-scheduled`.
150
+
151
+
=== General Purpose Thread Pool
152
+
153
+
This general purpose thread pool is used for most asynchronous actions.
154
+
The maximum number of threads used by this pool is configured using the `threadPoolMaxSize` URI parameter, e.g.:
155
+
156
+
----
157
+
tcp://host:61616?threadPoolMaxSize=10
158
+
----
159
+
160
+
By default, a global pool will be used and the default `threadPoolMaxSize` will be `Runtime.getRuntime().availableProcessors()` * 8.
161
+
If using a non-global pool the default `threadPoolMaxSize` is `-1`.
162
+
A value of `-1` signifies that the thread pool has _no upper bound_ and new threads will be created on demand if there are not enough threads already available to satisfy demand.
163
+
A value of `0` is not allowed.
164
+
The minimum valid value is `2`.
165
+
166
+
Any threads in this pool which are idle for `60` seconds will be terminated.
167
+
168
+
The name for threads from this pool will contain `activemq-client-factory`.
169
+
170
+
=== Netty Connectors
171
+
172
+
Netty threads for processing network traffic, by default, are capped on a per-connector basis at three times the number of cores (or hyper-threads) as reported by `Runtime.getRuntime().availableProcessors()`.
173
+
To override this value, you can set the number of threads by specifying the URI parameter `remotingThreads`.
174
+
See the xref:configuring-transports.adoc#configuring-the-transport[configuring transports] for more information on this.
175
+
176
+
Threads names will include the name of their corresponding acceptor with the prefix `activemq-remoting-`.
177
+
For example, for the acceptor named `amqp` the corresponding thread names will contain `activemq-remoting-amqp-<brokerName>`.
0 commit comments