IBM Support

Two steps are needed for setting TCPIP KeepAlive for IBM MQ

Question & Answer


Question

The method of setting TCP KeepAlive is different on each platform.
What is the method for the most commonly used platforms?

Cause

You are seeing problems with hung channels in IBM MQ.
For example:
- the queue manager has "orphaned" instances of SVRCONN channels where the client has lost its connection.
- or, a sender or receiver channel is in a RUNNING state even though the other end of the channel is no longer available.


Error messages such as the following might be observed in the queue manager logs:

Distributed platforms:
  • AMQ9489E  The maximum number of instances, <insert_1>, of channel <insert_3> was reached
    AMQ9490E  The maximum number of instances, <insert_1>, of channel <insert_3> was reached for an individual client.
    AMQ9513E  Maximum number of channels reached.
    AMQ9573E  Maximum number of active channels reached.

z/OS:
  • CSQX489E Maximum instance limit limit exceeded, channel channel-name connection conn-id 
    CSQX490E Maximum client instance limit limit exceeded, channel channel-name connection conn-id
    CSQX513E Current channel limit exceeded, channel channel-name connection conn-id 
    CSQX573E Channel channel-name exceeded active channel limit

Answer

There are 2 steps:
++ Step 1: Configure KeepAlive at the level of the Operating System
It affects all applications that use TCP/IP within the Operating System.
+ AIX:
To query the value:
  no -a tcp_keepintvl
  no -a tcp_keepidle

To set the value:
  no -o tcp_keepintvl=20
  no -o tcp_keepidle=120

The interval is in half-seconds. The parameter takes effect immediately. If the machine is rebooted, the parameter is reset to the default value. To make the change permanent, add the 'no' commands to the /etc/rc.net script.
https://www.ibm.com/support/pages/node/886355
IBM AIX: TCP keepalive probes
TCP keepalive has three timer options:
- TCP_KEEPIDLE: How long to wait before sending out the first probe on an idle connection
- TCP_KEEPINTVL: The frequency of keepalive packets after the first one is sent
- TCP_KEEPCNT: The number of unanswered probes required to force closure of the socket
+ Linux:

https://www.ibm.com/docs/en/ibm-mq/9.3?topic=linux-configuring-tuning-operating-system
IBM MQ / 9.3
Configuring and tuning the operating system on Linux
.
TCP/IP configuration
If you want to use keepalive for IBM MQ channels, you can configure the operation of the KEEPALIVE by using the kernel parameters:
net.ipv4.tcp_keepalive_intvl
net.ipv4.tcp_keepalive_probes
net.ipv4.tcp_keepalive_time
.
Write the number of seconds into: /proc/sys/net/ipv4/tcp_keepalive_time
.
See Using the TCP/IP SO_KEEPALIVE option for further information.
To view the current value of the parameter, log on as a user with root authority, and type sysctl Kernel-name.
To add or alter these values, log on as a user with root authority. Open the file /etc/sysctl.conf with a text editor, then add or change the following entries to your chosen values.
To load these sysctl values immediately, enter the following command sysctl -p.
If you do not issue the sysctl -p command, the new values are loaded when the system is rebooted.
.
See related articles:

+ Windows:
https://www.ibm.com/support/pages/node/707725
Enabling TCP/IP KeepAlive for IBM MQ on Windows
+ IBM i (iSeries):
Use CFGTCP option 3 (or CHGTCPA TCPKEEPALV(xxx)) to specify a time interval in minutes. You can specify a value in the range 1 through 40320 minutes; the default is 120.
+ z/OS:
Update your TCP/IP PROFILE data set and add or change the INTERVAL parameter in the TCPCONFIG section. The default is 2 hours.

 

++ Step 2: Enable KeepAlive for the IBM MQ Queue Manager
+ File: qm.ini
For more information, see the online manual:
https://www.ibm.com/docs/en/ibm-mq/9.3?topic=mqclientini-tcp-stanza-client-configuration-file
IBM MQ / 9.3
TCP stanza of the client configuration file
.
KeepAlive = YES|NO
.
Switch the KeepAlive function on or off. KeepAlive=YES causes TCP/IP to check periodically that the other end of the connection is still available.
If it is not, the channel is closed.
This attribute can be read by C, unmanaged .NET, IBM MQ classes for Java, IBM MQ classes for JMS, managed .NET, and managed XMS .NET clients.
+ IBM MQ Explorer:
- Open the IBM MQ Explorer, right click on the queue manager, then properties
- Select TCP
- In the TCP Keepalive drop-down box, choose "Yes"
image-20230504165137-1

+ AIX
Add KeepAlive=YES to the TCP stanza in the qm.ini file for the queue manager
+ Linux:
Add KeepAlive=YES to the TCP stanza in the qm.ini file for the queue manager
+ Windows:
https://www.ibm.com/support/pages/node/707725
Enabling TCP/IP KeepAlive for IBM MQ on Windows
+ IBM i (iSeries):
Add the following entry to your queue manager configuration file (qm.ini in the IFS directory, /QIBM/UserData/mqm/qmgrs/queue manager name):
TCP:
KeepAlive=yes
+ z/OS:
Issue the WebSphere MQ command:
  /cpf ALTER QMGR TCPKEEP(YES)
where 'cpf' is the command prefix for the queue manager subsystem, or include the command without "/cpf" in a member of the CSQINP2 concatenation, for example in CSQ4INYG.
You can set a per-channel keepalive interval to override the system default:

- For non-z/OS platforms, use the Heartbeat interval (HBINT). The default 300 seconds.
- For z/OS, use KeepAlive Interval (KAINT). The product documentation says:
"If AUTO is specified for KAINT, and it is a server-connection channel, the TCP INTERVAL value is used instead for the keepalive interval.
In this case, KAINT is zero in DISPLAY CHSTATUS; it would be non-zero if an integer had been coded instead of AUTO."
The default is AUTO. If you want to use a value different from the TCP/IP INTERVAL, you need to set KAINT to an integer, which should be greater than HBINT.
+++ end +++
 

[{"Type":"MASTER","Line of Business":{"code":"LOB45","label":"Automation"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSYHRD","label":"IBM MQ"},"ARM Category":[{"code":"a8m0z00000008OYAAY","label":"Connectivity-\u003EChannels"}],"ARM Case Number":"TS012920694","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"}]

Product Synonym

WMQ MQ

Document Information

Modified date:
08 May 2023

UID

swg21216834