5

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?

JTK
  • 1,469
  • 2
  • 22
  • 39

2 Answers2

7

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"/>
Ariel Carrera
  • 5,113
  • 25
  • 36
  • This was the solution I got on the Jboss forums, I had planned to come back and answer the question, you've saved me the trouble, thanks for your input. – JTK Mar 08 '16 at 00:07
  • Hi Johntk I updated the answer after talk with the wildfly team. Regards – Ariel Carrera Mar 09 '16 at 13:07
  • 1
    This solution did resolve the issues for me, I am using wildfly 10 CR4 – JTK Mar 10 '16 at 14:02
  • 1
    Ok Johntk! I tried with this and I can't solve my problem... but this parameter works for me: sh standalone.sh -c standalone-full.xml -Dactivemq.artemis.client.global.thread.pool.max.size=30 – Ariel Carrera Mar 10 '16 at 15:37
  • Just wanted to state that we had the same issue with Artemis chewing up our memory on Wildfly 10. We solved it by adding the `artemis thread.pool.max.size` to wildfly/bin/standalone.conf`. Inside the default `if` block checking for Java options, we added, `JAVA_OPTS="$JAVA_OPTS -Dactivemq.artemis.client.global.thread.pool.max.size=100"` – BRasmussen Aug 03 '18 at 17:20
  • ok! @BRasmussen! JAVA_OPTS variable is a good point to set this kind of command line parameters passed to the java virtual machine during wildfly initialization, memory settings, etc. Good point. – Ariel Carrera Aug 06 '18 at 12:58
1

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.