Hi
We have a system where MDBs in a JEE application deployed in Glassfish
v2.1.1 process messages on ActiveMQ v5.4.2-fuse-02-00 queues. In an
test-setup a test-driver generates a lot of messages on the queues in
ActiveMQ, so there is always "enough" messages to work with for the
MDB's. Despite that it does not seem that all MDB-instances as working
all the time. A lot of other stuff is going on on the system at the same
time so the system is under a certain amount of load, and that might be
a parameter in the "algoritm" deciding how many messages should be
processed concurrently by MDB's?
But basically I would like to know details about the "alogritm" that
decides when and how many messages are processed by MDB's concurrently.
A concrete question is why I experience, when you keep in mind that
there are plenty of messages to work with, that most of the time not
even 16 (stady-pool-size) msgs are processed at the same time? I believe
that there are always "enough" threads in the MDB-driving thread-pool
(mdb-threadpool - see below).
A little more details about our setup:
- We have set up a threadpool for MDB processing:
$GLASSFISH_INSTALL/bin/$ASADMIN_SCRIPT_NAME create-threadpool
--minthreadpoolsize 0 --maxthreadpoolsize 100 --idletimeout 120
--workqueues 1 mdb-threadpool
- We are using the resource-adapter that comes with ActiveMQ:
$GLASSFISH_INSTALL/bin/$ASADMIN_SCRIPT_NAME deploy --name activemqra
./fixed-config/glassfish/activemq-rar-5.4.2-fuse-02-00.rar
$GLASSFISH_INSTALL/bin/$ASADMIN_SCRIPT_NAME
create-resource-adapter-config --threadpools mdb-threadpool --property
ServerUrl=tcp\\://$ACTIVEMQ_HOST\\:$ACTIVEMQ_PORT activemqra
- We also use the resource-adapter to create a pool of connection to
ActiveMQ (a.o. used by other processen in the Glassfish application to
put new messages on ActiveMQ queues)
$GLASSFISH_INSTALL/bin/$ASADMIN_SCRIPT_NAME
create-connector-connection-pool --raname activemqra
--connectiondefinition javax.jms.ConnectionFactory --transactionsupport
XATransaction MessageQueueXAConnectionFactoryPool
$GLASSFISH_INSTALL/bin/$ASADMIN_SCRIPT_NAME create-connector-resource
--poolname MessageQueueXAConnectionFactoryPool
jms/MessageQueueXAConnectionFactory
- MDB's are annotated like this:
@MessageDriven(name = "MyMDB")
@TransactionManagement(TransactionManagementType.CONTAINER)
@TransactionAttribute(TransactionAttributeType.REQUIRED)
- sun-ejb-jar.xml has the following configuration-fragments for each MDB:
<ejb>
<ejb-name>MyMDB</ejb-name>
<bean-pool>
<steady-pool-size>16</steady-pool-size>
<resize-quantity>2</resize-quantity>
<max-pool-size>32</max-pool-size>
</bean-pool>
<mdb-resource-adapter>
<resource-adapter-mid>activemqra</resource-adapter-mid>
<activation-config>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>MyWPQ</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>maximumRedeliveries</activation-config-property-name>
<activation-config-property-value>0</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>maxMessagesPerSessions</activation-config-property-name>
<activation-config-property-value>100</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>maxSessions</activation-config-property-name>
<activation-config-property-value>10</activation-config-property-value>
</activation-config-property>
</activation-config>
</mdb-resource-adapter>
</ejb>
- Let me know if you need more info about our setup
Regards, Per Steffensen