WebSphere MQ 连接调整

标签 websphere ibm-mq connection-pooling

我有一个应用程序,它使用 MDB、激活规范和队列连接工厂从 WMQ 获取/放置消息。该应用程序预计最大负载为 80 tps。 Websphere Application Server 和 WMQ 都是集群式的,每个应用程序服务器都连接到单独的主机和 channel 。应用程序 onMessage 方法的实现方式是在消息被消费并发送响应后 session 和连接都关闭。

根据我们的配置,我们的 WAS 版本为 8.5,IBM MQ 队列管理器版本为 7,每个节点的行为规范的最大服务器 session 数设置为 40。每个节点的连接工厂中的最大连接数为 40,连接工厂的 session 池中的最大 session 数为 10。 现在,在峰值负载下,我们预计最多可创建 80 个 MQ channel 实例,但根据调查,我们可以看到它超过 200 个,这会在达到最大实例限制时导致出现问题。

发生这种情况是因为连接工厂 session 池中的最大 session 设置为 10 吗?

是否有可能即使我们在onMessage中关闭 session 和连接,一个连接仍然可以有多个 session 。如果是这种情况,将此属性设置为 1 是否明智? 此外,WMQ 上设置的某些属性可能会导致 MQ channel 实例的增加。

最佳答案

您没有提及 WAS 或 MQ 的特定版本,并且特定版本可能存在会改变行为的已知问题,但一般来说它应该按如下所述工作。

IBM 有一个很好的技术说明“TCP/IP Connection usage between WebSphere Application Server V7 and V8, and WebSphere MQ V7 (and later) explained”,其中详细介绍了这个主题。

您没有提及 SVRCONN channel 的 SHARECNV 设置为什么,如下所示,这将影响观察到的 channel 实例的数量,我将假设计算时使用默认值 10。

请注意,下面的引用 block 来自技术说明


  • 我们已将每个节点的行为规范的最大服务器 session 设置为40

上面的链接指出:

Maximum number of conversations = Maximum server sessions + 1

最大对话数 = 40 + 1 = 41

该链接还指出:

Maximum number of TCP/IP channel instances = Maximum number of conversations / SHARECNV for the channel being used

TCP/IP channel 实例的最大数量 = 41/10 = 5(四舍五入到最接近的值)连接)


  • 每个节点的连接工厂最大连接数40
  • 连接工厂的 session 池中的最大 session 数10

Maximum number of conversations = Connection Pool Maximum Connections + (Connection Pool Maximum Connections * Session Pool Maximum Connections)

最大对话数 = 40 + (40 * 10) = 440

Maximum number of TCP/IP channel instances = Maximum number of conversations / SHARECNV for the channel being used

TCP/IP channel 实例的最大数量 = 440/10 = 44


如果您的 MQ SVRCONN channel 的 SHARECNV 设置为 10,则基于连接到单独 channel 的每个节点,每个 channel 的 channel 实例不应超过 49 个.

如果您要达到 200 个 channel 实例,我怀疑您的 SHARECNV 小于 10。如果是 1,WAS 尝试创建的 channel 实例的最大数量将达到 481,这将受到 channel 的 MAXINST 限制为 200


After an application has finished with a JMS Connection and closed it off, it is moved from the Active Pool to the Free Pool, where it is available for reuse. The Connection Pool property Unused timeout defines how long a JMS Connection will stay in the Free Pool before it is disconnected. This property has the default value of 1800 seconds, which is 30 minutes.


Every JMS Connection that is created from a WebSphere MQ messaging provider Connection Factory has an associated JMS Session Pool, which work in the same way as Connection Pools. The maximum number of JMS Sessions that can be created from a single JMS Connection is determined by the Connection Factory Session Pool property Maximum connections. The default value of this property is 10.

A conversation is started when a JMS Session is first created, and will remain active until the JMS Session is closed because it has remained in the Free Pool for longer than the value of the Session Pool's Unused timeout property.

当您的应用程序在 onMessage 中关闭 session 和连接时,连接将移至空闲池以供重用,并且 session 将移至空闲池以供重用,直到达到各自的超时后,MQ Channel 实例才会关闭.

如果您希望将最大 channel 数保持在 200 以下,则可以将 session 池最大连接数调整为 1,与您的激活规范相结合,SHARECNV(1) 的最大值将为121 个 channel 实例。

您还可以增加 channel 的 SHARECNV 值,这将导致 channel 实例除以该数字。

您的连接或 session 可能没有正确关闭,并且出现“泄漏”。

关于WebSphere MQ 连接调整,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42101651/

相关文章:

ibm-mq - MQQueueManager(String queueManagerName) 抛出 MQException

performance - WebSphere SIB与MQ?从WebSphere上运行的J2EE应用程序中进行异步消息传递的最佳选择是什么?

ssl - 在 MQ 客户机上配置 SSL channel 连接

java - Apache Camel - 将消息路由到 JPA 端点 - 保持订单但根据类别 header 分成池

c# - .NET MongoDB 连接的最佳实践?

java - 非法参数异常 : Unsupported ciphersuite

websphere - 在 WebSphere 9 中使用 Mojarra 2.2

java - 如何解决由于 LTPA token 过期而导致的 Websphere Web 应用程序登录延迟?

websphere - 如何在websphere中配置和使用jSTL

java - Spring Boot 连接池配置最佳实践