Configuring connection pooling for the messaging REST API

You can configure the maximum number of pooled connections that can be used by the messaging REST API, and the behavior of the messaging REST API when all connections are in use.

Before you begin

To complete this task, you must be a user with certain privileges so that you can use the dspmqweb and setmqweb commands:
  • [z/OS]On z/OS®, you must have authority to run the dspmqweb and setmqweb commands, and write access to the mqwebuser.xml file.
  • [UNIX, Linux, Windows, IBM i]On all other operating systems, you must be a privileged user.
  • [Linux][MQ 9.3.5 Feb 2024]If the mqweb server is part of a stand-alone IBM® MQ Web Server installation, you must have write access to the mqwebuser.xml file in the IBM MQ Web Server data directory.
[z/OS]Attention:

Before you issue either the setmqweb or dspmqweb commands on z/OS, you must set the WLP_USER_DIR environment variable so that the variable points to your mqweb server configuration.

To set the WLP_USER_DIR environment variable, issue the following command:
export WLP_USER_DIR=WLP_user_directory
where WLP_user_directory is the name of the directory that is passed to crtmqweb. For example:
export WLP_USER_DIR=/var/mqm/web/installation1

For more information, see Create the mqweb server.

About this task

To optimize the performance of the messaging REST API, connections to IBM MQ queue managers are pooled. That is, instead of each REST request creating, using, and deleting its own connection, each REST request uses a connection from a connection pool. By default, 20 connections are available for each queue manager pool, and you can choose from three options for handling requests when all the connections are in use:
  • The messaging REST API can create a new, nonpooled connection to use for the request. This behavior is the default behavior.
  • The messaging REST API can return an error.
  • The messaging REST API can wait for a pooled connection to become available. This wait is an indefinite wait.

You can change the maximum number of pooled connections and the default behavior of the messaging REST API when all connections are in use by using the setmqweb properties command.

Procedure

  • View the current configuration by using the following command:
    dspmqweb properties -a
    • The mqRestMessagingFullPoolBehavior field shows the behavior of the messaging REST API when all the connections within the pool are in use. If the value is block, the messaging REST API must wait for a connection to become available. If the value is error, the messaging REST API must return an error. If the value is overflow, the messaging REST API must create a nonpooled connection to use, and dispose of the connection after use.
    • The mqRestMessagingMaxPoolSize field shows the maximum size of the connection pool.
  • Configure the behavior of the messaging REST API when all the connections within the pool are in use by using the following command:
    setmqweb properties -k mqRestMessagingFullPoolBehavior -v action
    where action specifies the action to take. action can be one of the following values:
    block
    When all the connections in the pool are in use, wait for a connection to become available.
    error
    When all the connections in the pool are in use, return an error.
    overflow
    When all the connections in the pool are in use, create a nonpooled connection to use, and dispose of the connection after it is used.
  • Configure the maximum connection pool size for each queue manager pool by using the following command:
    setmqweb properties -k mqRestMessagingMaxPoolSize -v size
    where size specifies the size of the pool.
    Note: If a large value for mqRestMessagingMaxPoolSize is set, and many queue managers are connected to, consider increasing the maximum size of the mqweb server heap. For more information, see tuning the mqweb server JVM .