MQ max connections issue

14,493

Assuming that your maximum number of conversations is set to 1 on the MQ Channel (the default is 10 in MQ v7 and v7.5) then a JMS Connection will result in a TCP connection (MQ channel instance) and a JMS Session will result in another TCP connection (MQ channel instance).

From your update it sounds like you have 10 JMS Connections configured and the sessionCacheSize in Spring set to 100, so 10 x 100 means 1000 potential MQ channel instances being created. The open output count will show how many 'active' JMS Sessions are attempting send a message and not necessarily how many have been 'cached'.

The conversation sharing on the MQ channel might help you here as this defines how many logical connections can be shared over one TCP connection (MQ channel instance). So the default of 10 conversations means you can have 10 JMS Sessions created that operate over just one TCP connection.

Share:
14,493
Bazza
Author by

Bazza

Updated on August 21, 2022

Comments

  • Bazza
    Bazza over 1 year

    I have a Java client that connects to MQ with 10 connections. These remain open for the duration that the Java client runs. For each thread we create a message, create a session, send the message and close the session. We are using the Spring CachingConnectionFactory and have a sessionCacheSize of 100. We have been told by our MQ engineering team is that that our queue manager has a max connections of 500 and that we are exceeding this. The QM.ini file has:

    maxChannels=500
    maxActiveChannels=256
    maxHandles=256
    

    What I have observed in MQ explorer is that the open output count on the queue remains static at 10, however if we load balance across 2 queues it's 10 on each, even though we still only have 10 connections. So what I'd like to know is what do jms connections and sessions equate to in MQ terminology?

    I did think that a connection equates to an active channel and a session is a handle, so it was the handles that we were possibly exceeding as the amount of sessions we open (and close) run into hundreds or thousands, whereas we only have 10 connections. Although going against this, the snippet below from IBM's Technote "Explanation of connection pool and session pool settings for JMS connection factories", suggests that the max channels should be greater than the max sessions, however we never know this as it depends on the load (unless this should be greater than the sessionCacheSize?).

    Each session represents a TCP/IP connection to the queue manager. With the settings mentioned here, there can be a maximum of 100 TCP/IP connections. If you are using WebSphere MQ, it is important to tune the queue manager's MaxChannels setting, located in the qm.ini file, to a value greater than the sum of the maximum possible number of sessions from each JMS connection factory that connects to the queue manager.

    Any assistance on how best to configure MQ would be appreciated.

  • Bazza
    Bazza almost 10 years
    Hi, thanks for the response. Excuse my ignorance, but does the max conversations relate to the max channels or max active channels in the qm.ini file, or neither? It's these properties that we appear to be exceeding. Is a TCP connection created for a session creation only when the conversation limit is breached, or does this happen for all sessions? Also, we have one instance of CachingConnectionFactory, all connections are created from this, is the session cache size per connection (as opposed to 100 across all connections)?
  • whitfiea
    whitfiea almost 10 years
    Max Channels means how many channels you can have defined on a queue manager. Whereas Max Active Channels means how many channel instances can be active on a queue manager. The Max conversations is a property on the channel itself and controls how many different logical connections can be mulitplexed over one channel instance. The qm.ini properties will be queue manager wide so there might be more than just your application connecting. You should ask your MQ admin how many channel instances are being used for channel.
  • Bazza
    Bazza almost 10 years
    OK I see. So is the sessionCacheSize for a single CachingConnectionFactory shared among all connections (so 100 across 10 connections) or for each connection (1000) in this case?
  • whitfiea
    whitfiea almost 10 years
    Reading the Spring doc for more detail the only thing it says is that the cache is 'per JMS Session type'. So I can't say for sure whether it is a cache for each JMS Connection created using that CachingConnectionFactory or scoped for the whole CachingConnectionFactory, it sounds like another SO question to be asked.
  • Bazza
    Bazza almost 10 years
    Yes, I came to the same conclusion.