The cluster workload management algorithm

This section lists the rules that the workload management algorithm applies, when determining the final destination for messages being put onto cluster queues. These rules are influenced by the settings applied to the following attributes for queues, queue managers and channels:

Table 3. Attributes for cluster workload management
Queues Queue managers Channels
  • CLWLPRTY
  • CLWLRANK
  • CLWLUSEQ
  • CLWLUSEQ
  • CLWLMRUC
  • CLWLPRTY
  • CLWLRANK
  • CLWLWGHT
  • NETPRTY

For more information, see Workload balancing attributes.

WebSphere MQ uses the following algorithm when choosing a destination for a message:

1. If a queue name is specified, queues that are not PUT enabled are eliminated. Remote instances of queues that do not share a cluster with the local queue manager are then eliminated. Next, remote CLUSRCVR channels that are not in the same cluster as the queue are eliminated.

2. If a queue manager name is specified, queue manager aliases that are not PUT enabled are eliminated. Remote CLUSRCVR channels that are not in the same cluster as the local queue manager are then eliminated.

3. If the result above contains the local instance of the queue, and the use-queue attribute of the queue is set to local (CLWLUSEQ(LOCAL)), or the use-queue attribute of the queue is set to queue manager (CLWLUSEQ(QMGR)) and the use-queue attribute of the queue manager is set to local (CLWLUSEQ(LOCAL)), the queue is chosen; otherwise a local queue is chosen if the message was not put locally (that is, the message was received over a cluster channel). User exits are able to detect this using the MQWXP.Flags, flag bit MQWXP_PUT_BY_CLUSTER_CHL and MQWQR.QFlags flag bit MQQF_CLWL_USEQ_ANY not set.

4. If the message is a cluster PCF message, any queue manager you have already sent a publication or subscription to is eliminated.

4a. All channels to queue managers or queue manager alias with a rank (CLWLRANK) less than the maximum rank of all remaining channels or queue manager alias are eliminated.

4b. All queues (not queue manager alias) with a rank (CLWLRANK) less than the maximum rank of all remaining queues are eliminated.

5. If only remote instances of a queue remains, resumed queue managers are chosen in preference to suspended ones.

6. If more than one remote instance of a queue remains, all MQCHS_INACTIVE and MQCHS_RUNNING channels are included.

7. If less than one remote instance of a queue remains, all MQCHS_BINDING, MQCHS_INITIALIZING, MQCHS_STARTING, and MQCHS_STOPPING channels are included.

8. If less than one remote instance of a queue remains, all MQCHS_RETRYING channels are included.

9. If less than one remote instance of a queue remains, all MQCHS_REQUESTING, MQCHS_PAUSED and MQCHS_STOPPED channels are included.

10. If more than one remote instance of a queue remains and the message is a cluster PCF message, locally defined CLUSSDR channels are chosen.

11. If more than one remote instance of a queue remains to any queue manager, channels with the highest NETPRTY to each queue manager are chosen.

11a. If a queue manager is being chosen: all remaining channels and queue manager alias' other than those with the highest priority (CLWLPRTY) are eliminated. If any queue manager alias' remain, channels to the queue manager are kept.

11b. If a queue is being chosen: all queues other than those with the highest priority (CLWLPRTY) are eliminated, and channels are kept.

11c. All channels except a number of channels with the highest values in MQWDR.DestSeqNumber are eliminated. The number of channels not eliminated equals the number of most-recently-used (CLWLMRUC).

12. If more than one remote instance of a queue remains, the least recently used channel is chosen (that is, the one with the lowest value in MQWDR.DestSeqFactor). If there is more than one with the lowest value, one of those with the lowest value in MQWDR.DestSeqNumber is chosen. The destination sequence factor of the choice is advanced by the queue manager, by approximately the amount 1000/Channel weight (CLWLWGHT). The destination sequence factors of all destinations are reset to zero if the cluster workload attributes of available destinations are altered, or if new cluster destinations become available. Also, the destination sequence number of the choice is set to the destination sequence number of the previous choice plus one, by the queue manager.

Note that the distribution of user messages is not always exact, because administration and maintenance of the cluster causes messages to flow down channels. This can result in an apparent uneven distribution of user messages which can take some time to stabilize. Because of this, no reliance should be made as to the exact distribution of messages during workload balancing.