Load balancing issue when connecting to IBM MQ using JMS + CCDT file

We are trying to connect to IBMMQ using the CCDT file and JMS configuration. We can connect to it, but we have a problem:

since we use spring to establish a factory connection with the CCDT file, this is initialized once at the beginning of the application, but, unfortunately, it selects only one queue manager at a time, that is, it sends all messages to the same queue manager and does not load the balance.

Although I noticed that if I manually installed the CCDT file before each request, then it could load the balance of the queue managers, ideally it looks to me. The queue manager is determined when I set the URL to the CCDT file. which is bad practice. I expected to initialize the factory connection with the CCDT file, and then this configuration will be able to load the balance on its own.

Can you help me?

+1
source share
1 answer

This is the expected behavior. MQ does not load balance customers, this connection balances them. A connection is the most time-consuming API call, and in the case of a mutually authenticated TLS connection, it may take several seconds. Therefore, a good application design will try to connect once, and then maintain this connection throughout the session. The JMS architecture and Spring framework await this pattern.

The way that MQ provides load balancing (again, not balancing, but rather a circular distribution), is that the client connects the jump from the cluster target queue. A message addressed to this cluster target queue will be cyclically distributed among all instances of this queue.

If this is a request-to-request application, then when listening to requests in these cluster instances of the queue, it refers to the response message using the Reply-To QMgr and Reply-To Queue from the requesting message. In this case, interrogators can fail through QMgr in QMgr if they lose the connection. Listening systems for records in clustered queues are usually not interrupted in all queue managers to ensure that all queue instances are serviced due to transaction recovery.

The short answer is that the CCDT client and MQ are not at all the place of MQ load balancing. The client must establish the connection and hold it as long as possible. Client reconnection and CCDT are only for balancing the connection.

Load balancing is a feature of the MQ cluster. This requires multiple instances of the cluster queue, and they are usually a network move from the client application that places the message.

+3
source

All Articles