Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Java Message Service (JMS) transport of the WSO2 Enterprise Integrator (WSO2 EI) 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 EI for better performance.

Table of Contents
maxLevel35

Increase the maximum number of JMS proxies

...

  1. Open the integrator.sh or integrator.bat file in your <EI_HOME>/bin directory for editing.
  2. Change the values of the properties as follows: 

    Tip

    If you do not have the following properties in the integrator.sh or integrator.bat files, add them with the given values.

    • -Dlst_t_core=200
    • -Dlst_t_max=250
    • -Dsnd_t_core=200
    • -Dsnd_t_max=250

...

Add the following parameters to the JMS listener configuration of the <EI_HOME>/conf/axis2/axis2.xml file:

Code Block
languagexml
<parameter name="transport.jms.ConcurrentConsumers" locked="false">50</parameter> 
<parameter name="transport.jms.MaxConcurrentConsumers" locked="false">50</parameter>

...

Add the following parameter to the JMS listener configuration of the  <EI_HOME>/conf/axis2/axis2.xml file to enable caching:

Code Block
languagexml
<parameter name="transport.jms.CacheLevel">consumer</parameter>

...

Code Block
languagexml
titleSample JMS listener configuration with concurrent consumers and caching
<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 proxy-level throttling

Info

The following feature is supported in WSO2 EI 6.1.0 as a product update. This update is availble through WSO2 Update Manager from the 17th of September, 2019 onwards.

Throttling can be configured in a proxy service (JMS consumer) to control the number of JMS messages that are processed by the service. To enable throttling, the 'jms.proxy.throttle.enabled' parameter should be added to the proxy service as shown below. By default, throttling is disabled for a JMS consumer.

Code Block
<?xml version="1.0" encoding="UTF-8"?><proxy xmlns="http://ws.apache.org/ns/synapse" name="StockQuoteProxy" startOnLoad="true" statistics="disable" trace="disable" transports="jms">
    <target>
        <inSequence>
            ..........
        </inSequence>
    </target>
    <parameter name="jms.proxy.throttle.enabled">true</parameter>
    .........
    <description/>
</proxy>

When this parameter is enabled, the JMS consumer can consume a maximum of 60 messages during a 60 second (one minute) window at a fixed rate of one message per second. If required, you can configure the maximum number of messages that can be consumed (throttle limit) and the rate at which messages are consumed (throttle mode) during the 60 second window.

Insert excerpt
JMS Transport
JMS Transport
nopaneltrue

In the following example, a maximum of 30 messages can be consumed during 60 seconds at a default fixed rate of one message every two seconds.

Code Block
<?xml version="1.0" encoding="UTF-8"?><proxy xmlns="http://ws.apache.org/ns/synapse" name="StockQuoteProxy" startOnLoad="true" statistics="disable" trace="disable" transports="jms">
    <target>
        <inSequence>
            ..........
        </inSequence>
    </target>
    <parameter name="jms.proxy.throttle.enabled">true</parameter>
    <parameter name="jms.proxy.throttle.limitPerMinute">30</parameter>
    .........
    <description/>
</proxy>

In the following example, the throttle mode is set to 'batch'. Therefore, messages received will be consumed as quickly as possible until the throttle limit is reached or until the window expires.

Code Block
<?xml version="1.0" encoding="UTF-8"?><proxy xmlns="http://ws.apache.org/ns/synapse" name="StockQuoteProxy" startOnLoad="true" statistics="disable" trace="disable" transports="jms">
    <target>
        <inSequence>
            ..........
        </inSequence>
    </target>
    <parameter name="jms.proxy.throttle.enabled">true</parameter>
    <parameter name="jms.proxy.throttle.mode">batch</parameter>
    <parameter name="jms.proxy.throttle.limitPerMinute">30</parameter>
    .........
    <description/>
</proxy>

Configuring JMS Sender

Enabling caching

Add the following parameter to the JMS sender configuration of the  <EI_HOME>/conf/axis2/axis2.xml file:

Code Block
languagexml
<parameter name="transport.jms.CacheLevel">producer</parameter>

...