The cluster workload management algorithm

The workload management algorithm uses workload balancing attributes and many rules to select the final destination for messages being put onto cluster queues.

This section lists the workload management algorithm used 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 1. Attributes for cluster workload management
Queues Queue managers Channels
  • CLWLPRTY
  • CLWLRANK
  • CLWLUSEQ
  • CLWLUSEQ
  • CLWLMRUC
  • CLWLPRTY
  • CLWLRANK
  • CLWLWGHT
  • NETPRTY
Initially, the queue manager builds a list of possible destinations from two procedures:
  • Matching the target ObjectName and ObjectQmgrName with queue manager alias definitions that are shared in the same clusters as the queue manager.
  • Finding unique routes, or in other words, channels, to a queue manager that hosts a queue with the name ObjectName and is in one of the clusters that the queue manager is a member of.

The steps of the algorithm that follow eliminate destinations from the list of possible destinations.

  1. If a queue name is specified:
    1. Queues that are not put enabled are eliminated as possible destinations.
    2. Remote instances of queues that do not share a cluster with the local queue manager are eliminated.
    3. Remote CLUSRCVR channels that are not in the same cluster as the queue are eliminated.
  2. If a queue manager name is specified,
    1. Queue manager aliases that are not put enabled are eliminated.
    2. Remote CLUSRCVR channels that are not in the same cluster as the local queue manager are eliminated.
  3. If the resulting set of queues contains the local instance of the queue, the local instance of a queue is typically used. The local instance of the queue is used if one of these three conditions are true:
    • The use-queue attribute of the queue, CLWLUSEQ is set to LOCAL.
    • Both the following are true:
      1. The use-queue attribute of the queue, CLWLUSEQ is set to QMGR.
      2. The use-queue attribute of the queue manager, CLWLUSEQ is set to LOCAL.
    • The message is received over a cluster channel rather than by being put by a local application.
      Note: You can detect a message from a cluster channel in a user exit if the both the MQWXP_PUT_BY_CLUSTER_CH and MQQF_CLWL_USEQ_ANY flags are not set:
      • MQWXP.Flags flag MQWXP_PUT_BY_CLUSTER_CH.
      • MQWQR.QFlags flag MQQF_CLWL_USEQ_ANY.
  4. If the message is a cluster PCF message, any queue manager to which a publication or subscription has already been sent is eliminated.
  5. All channels to queue managers or queue manager alias with a CLWLRANK less than the maximum rank of all remaining channels or queue manager aliases are eliminated.
  6. All queues (not queue manager aliases) with a CLWLRANK less than the maximum rank of all remaining queues are eliminated.
  7. If only remote instances of a queue remain, resumed queue managers are chosen in preference to suspended ones.
  8. If more than one remote instance of a queue remains, all channels that are inactive or running are included. The state constants are listed:
    • MQCHS_INACTIVE
    • MQCHS_RUNNING
  9. If no remote instance of a queue remains, all channels that are in binding, initializing, starting, or stopping state are included. The state constants are listed:
    • MQCHS_BINDING
    • MQCHS_INITIALIZING
    • MQCHS_STARTING
    • MQCHS_STOPPING
  10. If no remote instance of a queue remains, all channels that are being tried again, MQCHS_RETRYING are included.
  11. If no remote instance of a queue remains, all channels in requesting, paused, or stopped state are included. The state constants are listed:
    • MQCHS_REQUESTING
    • MQCHS_PAUSED
    • MQCHS_STOPPED
  12. If more than one remote instance of a queue remains and the message is a cluster PCF message, locally defined CLUSSDR channels are chosen.
  13. If more than one remote instance of a queue to any queue manager remains, channels with the highest NETPRTY value for each queue manager are chosen.
  14. If a queue manager is being chosen:
    • All remaining channels and queue manager aliases other than channels and aliases with the highest priority, CLWLPRTY, are eliminated. If any queue manager aliases remain, channels to the queue manager are kept.
  15. If a queue is being chosen:
    • All queues other than queues with the highest priority, CLWLPRTY, are eliminated, and channels are kept.
  16. All channels, except a number of channels with the highest values in MQWDR.DestSeqNumber are eliminated. The elimination stops when the number of remaining channels is no greater than the maximum allowed number of most recently used channels, CLWLMRUC.
  17. If more than one remote instance of a queue remains, the least recently used channel is chosen. The least recently used channel has the lowest value of MQWDR.DestSeqFactor.
    • If there is more than one channel with the lowest value, one of the channels with the lowest value in MQWDR.DestSeqNumber is chosen.
    • The destination sequence factor of the choice is increased by the queue manager, by approximately 1000/CLWLWGHT.
    Note:
    1. The destination sequence factors of all destinations are reset to zero if the cluster workload attributes of available CLUSRCVR channels are altered. The sequence factors are zeroed if new CLUSRCVR channels become available.
    2. Modifications to workload attributes of manually defined CLUSSDR channels do not reset the Destination Sequence Factor.

The distribution of user messages is not always exact, because administration and maintenance of the cluster causes messages to flow across channels. The result is an uneven distribution of user messages which can take some time to stabilize. Because of the mixture of administration and user messages, place no reliance on the exact distribution of messages during workload balancing.