I have a Wildfly AS
setup for JMS, I;m monitoring it with Jconsole and have noticed that before I even create a session on my Consumer
or Producer
the thread count is steadily increasing, I was previously using Wildfly 9 final
for the same purpose, it's thread usage was steady even during use, but it had a memory leak which prompted me to upgrade.
In Jconsole
I can see:
Thread-2(ActiveMQ-client-global-threads-3258368)
Thread-4(ActiveMQ-client-global-threads-3258368)
Thread-5(ActiveMQ-client-global-threads-3258368)
Thread-6(ActiveMQ-client-global-threads-3258368)
.
.
.
Thread-16(ActiveMQ-client-global-threads-3258368)
How do I solve this problem? is there a setting I can change that is causing these threads to spawn, is there any more information I can take from Jconsole
to help me resolve this?
Update: I tried with this configuration and it doesn't work for me. The reason is that ActiveMq Artemis uses a fixed thread pool executor and it is configured to 500 threads. It will be solved in Wildfly after somoe changes in Artemis. You can check the status in Jira (look in the last comments):
https://issues.jboss.org/browse/JBEAP-2947
Forum:
https://developer.jboss.org/thread/268397
Workaround:
sh standalone.sh -c standalone-full.xml -Dactivemq.artemis.client.global.thread.pool.max.size=30
Original Answer:
Have you tried setting remote connection properties?
<connection-factory name="RemoteConnectionFactory"
entries="java:jboss/exported/jms/RemoteConnectionFactory"
connectors="http-connector" use-global-pools="false"
thread-pool-max-size="10"/>
You can fine tuning the MDB for a specific use case just setting the properties useGlobalPools
to false and threadPoolMaxSize
according to the expected limit:
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationLookup", propertyValue = "queue/emailQueue"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "useGlobalPools", propertyValue = "false"),
@ActivationConfigProperty(propertyName = "threadPoolMaxSize", propertyValue = "20"),
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge") })
If you set the connection factory properties use-global-pools="false"
and
thread-pool-max-size="20"
in the standalone.xml or even pass as a VM argument, you will have a global behavior applied for all MDBs, it is maybe not a good idea.
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