[oct2010]

Configuring WebSphere MQ connection pooling

Use scripts to administer WebSphere® MQ Version 6.0 connection pooling on WebSphere Application Server Version 6.1 nodes, using a WebSphere Application Server Version 7.0 Deployment Manager.

About this task

WebSphere MQ Version 6.0 and earlier WebSphere MQ JMS clients provide a connection pooling layer that you can configure in addition to the connection pooling provided by WebSphere Application Server.

When a connection is no longer required and is removed from the application server's connection pool, WebSphere MQ can pool the underlying connection to the queue manager and reuse it later instead of destroying it.

This connection pooling does not function for JMS connections in the following circumstances:
  • You have made the connection using the WebSphere MQ Version 7.0 JCA Resource Adapter that is available in Version 7.0 nodes.
  • You have used the MQ_INSTALL_ROOT variable to configure WebSphere MQ Version 7.0 or a later WebSphere MQ JMS Client to connect to a WebSphere Application Server Version 6.1 node.

To enable WebSphere MQ Version 6.0 connection pooling, you must select the Enable MQ Connection Pooling property on the connection factory that you are using to create connections to WebSphere MQ. This property is not available in the WebSphere Application Server Version 7.0 administrative console. Therefore, to enable or disable this property you must use scripting, as detailed in this task.

In addition to enabling the WebSphere MQ Version 6.0 connection pooling property on the connection factory, you can optimize the configuration of WebSphere MQ Version 6.0 connection pooling within an application server.

Note: When a connection has been created from a connection factory that has WebSphere MQ connection pooling enabled, connection pooling is enabled for the entire application server. Any JMS connections created to WebSphere MQ when the pool is active are automatically pooled, regardless of whether connection pooling is enabled on the connection factory used to create the connection.
Note: If a firewall is being used that closes idle connections, the total of the unused timeout configured on the WebSphere Application Server connection pool and the MQJMS.POOLING.TIMEOUT configured in WebSphere MQ connection pooling must be less than the idle timeout configured on the firewall to allow connections to be cleaned up by the connection pools, rather than being terminated by the firewall.

Procedure

  1. Display the Message Listener Service properties for the application server:
    1. In the navigation pane, click Servers > Application Servers.
    2. In the content pane, click the name of the application server.
    3. Under Additional Properties, click Message Listener Service properties.
  2. Select Custom Properties, then to optimize WebSphere MQ connection pooling, add the following custom properties:
    MQJMS.POOLING.THRESHOLD
    The maximum number of unused connections in the pool. If you do not specify this value it defaults to 10.
    MQJMS.POOLING.TIMEOUT
    The timeout in milliseconds for unused connections in the pool. If you do not specify this value it defaults to 5 minutes.
  3. Click OK.
  4. Save any changes to the master configuration.
  5. Save the following script into a file called controlWMQConnectionPooling.py:
    import sys; import re; # The single parameter for this script is 'true' to enable, or 'false' to disable trueOrFalse = sys.argv[0]; # Build a list of all WMQ connection factory objects, at all scopes cfList = []; cfList.extend(re.split('\r?\n', AdminConfig.list('MQConnectionFactory'))); cfList.extend(re.split('\r?\n', AdminConfig.list('MQQueueConnectionFactory'))); cfList.extend(re.split('\r?\n', AdminConfig.list('MQTopicConnectionFactory'))); # Iterate through all valid objects in the list for cf in cfList:   if cf != '':     # Modify the object to enable/disable WMQ Connection Pooling     AdminConfig.modify(cf, '[[useConnectionPooling ' + trueOrFalse + ']]');     print "Set useConnectionPooling to " + trueOrFalse + " for " + cf; # Save the changes AdminConfig.save();
  6. To enable or disable connection pooling, choose the appropriate option from the following list:
    • To enable connection pooling on all your connection factories run the script as follows:
      • For Windows® run:
        DMGR_PROFILE_ROOT\bin\wsadmin.bat -lang jython -f controlWMQConnectionPooling.py true
      • For Unix or z/OS® run:
        DMGR_PROFILE_ROOT/bin/wsadmin.sh -lang jython -f controlWMQConnectionPooling.py true
    • To disable connection pooling on all your connection factories run the script as follows:
      • For Windows run:
        DMGR_PROFILE_ROOT\bin\wsadmin.bat -lang jython -f controlWMQConnectionPooling.py false
      • For Unix or z/OS run:
        DMGR_PROFILE_ROOT/bin/wsadmin.sh -lang jython -f controlWMQConnectionPooling.py false
  7. Synchronize all the nodes using the administrative console.
  8. To have the changed configuration take effect, stop then restart the application server.

What to do next

For additional information, see the WebSphere MQ information center http://www.ibm.com/software/integration/wmq/library/.




In this information ...


IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic    

Terms of Use | Feedback

Last updated: Oct 20, 2010 7:53:43 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=compass&product=was-nd-dist&topic=tmj_mqcon
File name: tmj_mqcon.html


[oct2010]
oct2010