WSO2 ESB's Java Message Service (JMS) transport allows you to easily send and receive messages to queues and topics of any JMS service that implements the JMS specification. The following sections describe how you can tune the JMS transport of WSO2 ESB for better performance.
...
Anchor | ||||
---|---|---|---|---|
|
...
Using concurrent consumers
Concurrent consumers is the minimum number of threads for message consuming. If there are more messages to be consumed while the running threads are busy, then additional threads are started until the total number of threads reaches the value of he maximum number of concurrent consumers (ie., MaxConcurrentConsumers
). The maximum number of concurrent consumers (or the number of JMS proxies) that can be deployed is limited by the base transport worker pool that is used by the JMS transport. The size of this worker pool can be configured via the system property 'lst_t_core' and 'lst_t_max' as described above. The number of concurrent producers are generally limited by the Synapse core worker pool.
...
Add the following parameters to the JMS listener configuration of the <ESB_HOME>/repository/conf/axis2/axis2.xml
file:
Code Block | ||
---|---|---|
| ||
<parameter name="transport.jms.ConcurrentConsumers" locked="false">50</parameter> <parameter name="transport.jms.MaxConcurrentConsumers" locked="false">50</parameter> |
Parameters
transport.jms.ConcurrentConsumers
: the concurrent threads that need to be started to consume messages when polling.transport.jms.MaxConcurrentConsumers
: the maximum number of concurrent threads to use during polling.
Anchor | ||||
---|---|---|---|---|
|
...
Add the following parameter to the JMS listener configuration of the <ESB_HOME>/repository/conf/axis2/axis2.xml
file to enable caching:
Code Block | ||
---|---|---|
| ||
<parameter name="transport.jms.CacheLevel">consumer</parameter> |
The possible values for the cache level are none
, auto
, connection
, session
and consumer
. Out of the possible values, consumer
is the highest level that provides maximum performance.
After adding concurrency consumers and cache level, your complete configuration would be as follows:
Code Block | ||||
---|---|---|---|---|
| ||||
<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener"> .... <parameter name="myQueueConnectionFactory" locked="false"> <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.ConcurrentConsumers" locked="false">50</parameter> <parameter name="transport.jms.MaxConcurrentConsumers" locked="false">50</parameter> <parameter name="transport.jms.CacheLevel">consumer</parameter> </parameter> …. </transportReceiver> |
Configuring JMS Sender
...
Enabling caching
...
Add the following parameter to the JMS sender configuration of the <ESB_HOME>/repository/conf/axis2/axis2.xml
file:
Code Block | ||
---|---|---|
| ||
<parameter name="transport.jms.CacheLevel">producer</parameter> |
...
To remove the ClientApiNonBlocking
property
Add the following parameter to the configuration:
Code Block | ||
---|---|---|
| ||
<property name="ClientApiNonBlocking" action="remove" scope="axis2"/>
|