Monitoring server session pools for listener ports

You can minimize the number of resources that server sessions use by enabling server session pool monitoring and defining the timeout value to be applied to a server session.

About this task

Each listener port uses one or more server sessions, which are held in a server session pool. Each server session is associated with a JMS session, which is taken from the JMS session pool that is associated with the JMS connection factory that the listener port is configured to use.

By default, server session pool monitoring is disabled. When a listener port uses a server session the listener port does not release the server session from the server session pool until the listener port is shut down. This means that the associated JMS session is not released into the JMS session pool until the listener port is shut down, even if the listener port is not processing any messages. Consequently the resources that the JMS session uses, for example TCP/IP connections, can be held for a long time, and this can cause problems for resource-constrained systems.

To minimize the number of resources that server sessions use, you must monitor the server session pools. When you enable server session pool monitoring each server session in each server session pool that a listener port uses is monitored to determine how much time has elapsed since the server session was last used. If the elapsed time is greater than the timeout value that you have configured, the server session is removed from the server session pool and its associated JMS session is returned to the JMS session pool. The returned JMS session can be either reused by another application or closed, depending on your JMS session pool settings. You can also configure additional pooling mechanisms, depending on your JMS provider.

Note: Server session pool monitoring cannot be used if the message listener service is operating in non-Application Server Facilities (non-ASF) mode, that is if the NON.ASF.RECEIVE.TIMEOUT message listener service custom property is set to a non-zero value.

[z/OS]Non-ASF mode cannot be selected on z/OS systems.

Procedure

  • To enable server session pool monitoring, configure the following message listener service custom properties on each application server as required.
    SERVER.SESSION.POOL.REAP.TIME
    To enable server session pool monitoring, set this property to the time in seconds between checks on server session pools (this must be a non-negative value).
    SERVER.SESSION.POOL.UNUSED.TIMEOUT
    To specify the default server session pool timeout, set this property to the required number of seconds for the timeout. When this property is set to a non-negative value, it is compared with the time that has elapsed since a server session was used. If the timeout value is less than the elapsed time, the server session is removed from the server session pool and its JMS session is returned to the JMS session pool. For example, if the timeout value is one second and the time that has elapsed since a particular server session was used is two seconds, that server session is removed from the server session pool and its JMS session is returned to the JMS session pool.
    SERVER.SESSION.POOL.UNUSED.TIMEOUT.lpname
    To override the default SERVER.SESSION.POOL.UNUSED.TIMEOUT value for the listener port with the name lpname, set this property to the appropriate value:
    • To override the SERVER.SESSION.POOL.UNUSED.TIMEOUT for the specified listener port, set this property to a non-negative value defining the required number of seconds for the server session timeout for this listener port.
    • To disable server session pool monitoring for the specified listener port, set this property to a negative value.
    The value that you set for this property applies to all message-driven beans that are using the specified listener port.
  • [z/OS]Additionally, to enable server session pool monitoring on z/OS® systems, perform the following steps:
    1. Start the administrative console.
    2. In the navigation pane, select one of the following paths:

      Resources > JMS->Connection factories

      Resources > JMS->Queue connection factories

      Resources > JMS->Topic connection factories

    3. Optional: Select the Scope corresponding to the scope of the connection factory that you want to view.
    4. From the list of connection factories, select the connection factory used by the listener port.
      The properties of the connection factory are displayed in the content pane.
    5. Under Additional Properties, select Custom properties.
      The custom properties of the connection factory are displayed in the content pane.
    6. Click New.
    7. Set the Name to was_nondeferredreaper and set the Value to true. Leave the other properties with their default values.
    8. Click OK.
    9. Save your changes to the master configuration.
    10. To have a changed configuration take effect, stop then restart the application server.

Example

For example, consider an application server that is configured with listener ports lp1, and lp2.

The following rules apply:
No properties set
If none of the properties are set, server session pool monitoring is disabled and JMS sessions used by server sessions are not returned to the JMS session pool until the listener port (lp1 or lp2), or its associated message-driven bean, is shut down.
SERVER.SESSION.POOL.REAP.TIME and SERVER.SESSION.POOL.UNUSED.TIMEOUT set
Consider, for example, the following settings:
  • SERVER.SESSION.POOL.REAP.TIME=60
  • SERVER.SESSION.POOL.UNUSED.TIMEOUT=120
The server session pool of both listener ports (lp1 and lp2) is checked for inactive server sessions every 60 seconds. If a server session is detected as being inactive for more than 120 seconds, it is removed from the server session pool and its JMS session is returned to the JMS session pool. Taking into account the SERVER.SESSION.POOL.REAP.TIME value, the server session pool could be removed from the session pool between two and three minutes after the server session was last used.
SERVER.SESSION.POOL.REAP.TIME and SERVER.SESSION.POOL.UNUSED.TIMEOUT set, and overrides set for SERVER.SESSION.POOL.UNUSED.TIMEOUT.lpname
Consider, for example, the following settings:
  • SERVER.SESSION.POOL.REAP.TIME=60
  • SERVER.SESSION.POOL.UNUSED.TIMEOUT=120
  • SERVER.SESSION.POOL.UNUSED.TIMEOUT.lp2=-1
  • SERVER.SESSION.POOL.UNUSED.TIMEOUT.lp1=60
The server session pool for listener port lp2 is not checked because it has a negative timeout value. In the server session pool for listener port lp1, any server sessions that are inactive for more than 60 seconds are removed from the server session pool.