Automatic application balancing

Automatic application balancing greatly enhances application distribution and availability by enabling an IBM MQ uniform cluster to closely manage application distribution across the cluster, rather than relying on randomization, or a manual pinning of applications to specific queue managers.

From Version 9.2.0, automatic balancing across a set of clustered queue managers is supported for applications written in C, JMS, IBM MQ .NET, XMS .NET.

When there are at least as many instances of the same application as there are queue managers, the uniform cluster constantly ensures that every queue manager has at least one instance of the application connected.

Applications can remove a specific affinity to a queue manager, and instead use a client channel definition table (CCDT) to randomize connectivity to the group of queue managers in the uniform cluster safely. Applications can do this for the following reasons:

  • When there are enough consuming application instances, there is always an instance of the application processing messages.
  • When you stop a queue manager, any connected application instances are evenly distributed across the remaining queue managers in the cluster.
  • When you start a queue manager, any application instances connected to other queue managers in the cluster are automatically rebalanced to include the newly started queue manager.

This means that the uniform cluster continually ensures that applications are optimally distributed, maximizing message processing, even in the event of planned and unplanned outages.

To achieve auto-balancing, the queue managers in the uniform cluster periodically share information between themselves. They do this by publishing metadata on system topics under the reserved $SYS/MQ branch of the topic tree. Every queue manager in the uniform cluster subscribes to messages published by other queue managers, and builds a picture of the state of the applications in the uniform cluster.

The queue managers monitor the distribution of client applications across the entire cluster. When the number of applications connected to a specific queue manager is sufficiently low that it determines the cluster is unbalanced, that queue manager publishes a request on a system topic to one of the other queue managers in the cluster.

When the message is received, the target queue manager requests one of its client applications to redirect to the requesting queue manager. The client application receives the redirect request, closes its connection, and reconnects to the requesting queue manager. This automatic balancing mechanism is transparent to the application. For more information, see How automatic balancing works.

By periodically distributing meta-data about connected applications, the uniform cluster can achieve a broadly balanced ratio of client applications to queue managers over time. To prevent rapid successive redirect events from occurring, the auto-balancing algorithm limits the rate at which redirect requests are made.

We can monitor the current state of applications across queue managers in a cluster, and monitor application instances. For more information, see Monitor application balancing. You can also solve various issues with application balancing, as described in Application balancing troubleshooting.

Rebalancing is only useful for applications with a long connection time. If we have client applications with short connection times, for example client applications that are written to connect and disconnect regularly to different queue managers, we should configure them as not being reconnectable. This removes them from the set of applications that the queue managers try to balance.

Parent topic: About uniform clusters


Related concepts