MQ 连接超时设置

Problem(Abstract)
The number of client channels increase over time and never decreases._
Cause
This occurs because the queue manager does not detect that the client has been disconnected, and therefore holds onto the transaction.
Resolving the problem
To ensure the queue manager detects when the client is no longer there, set a new property on the Channel Stanza named ClientIdle. This property is set to a value that is defined in seconds.

Windows——————在系统注册表中添加ClientIdle项
Use the following command: 
amqmdain reg <qm_name> -c add -s Channels -v ClientIdle=<val_in_secs>
例如:amqmdain reg QM_PICP_313458000013_01 -c add -s Channels -v ClientIdle=300
--------------从注册表中删除执行以下命令:amqmdain reg QM_PICP_313458000013_01 -c remove -s Channels -v ClientIdle

UNIX and iSeries————————在qm.ini中修改
Set in the QM.ini file using a new stanza, as follows:
Channels: 
ClientIdle=<val_in_secs>

Note: On all operating systems, you must restart the queue manager for the parameter to take effect .

Additional information
An explanation of the ClientIdle property from WebSphere MQ development:

A brief description of how the ClientIdle property works is in the case of a CLNTCONN/SVRCONN channel pair. If the client terminates due to a network connection problem, the queue manager fails to detect that the client has been disconnected and therefore holds onto the transaction. In this case the queue manager will wait for a transaction command (prepare,commit, etc.) from the client , but this will not happen because the client is no longer available.

In such situations the queue manager can be made aware of the orphaned connection by either setting the TCP KeepAlive in the qm.ini .This is a OS parameter and defaults to 2 hours .The SVRCONN will detect of failed client connection and will be cleaned the next time the KeepAlive is triggered. 
The other solution to the above is to implement an 'undocumented' tuning parameter 'ClientIdle' under the Channels stanza in the qm.ini.

Client Idle Time Out provides a mechanism to allow system administrators to specify the equivalent of a disconnect(DISCINT) for SVRCONN channels. After the Client Idle period has elapsed without any 
communication from the client, the server MCA will close the connection to the client.

Without Client Idle Time Out, there is no mechanism for 'timing out' SVRCONN connections which have not performed any activity for some time. Because of the nature of SVRCONN connections, a client which has disconnected without sending notification will also result in the SVRCONN MCA hanging for a long time(potentially with an associated uncommitted Unit of Work), until TCP/IP KeepAlive is triggered to free it up.

The ClientIdle parameter is available from version 5.3 onwards, so this feature will not be effective on 5.2 libraries.

Setting the ClientIdle to 10 minutes will cause the svrconn channel to remain active for 10 minutes, then close the connection if there is no activity from the client side during that 10 minute interval. The ClientIdle parameter will help in closing any orphaned or hung channel connections, and will not have a negative impact on performance.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值