illustration, page sets, relationship to messages and page sets, relationship to messages and buffer pools, relationship to buffer pools and page sets, messages" /> Buffers and buffer pools

 

Buffers and buffer pools

For efficiency, WebSphere MQ uses a form of caching whereby messages (and object definitions) are stored temporarily in buffers before being stored in page sets on DASD. Short-lived messages, that is, messages that are retrieved from a queue shortly after they are received, might only ever be stored in the buffers. However, this is all transparent to the user because the buffers are controlled by a buffer manager, which is a component of WebSphere MQ.

The buffers are organized into buffer pools. You can define up to 16 buffer pools (0 through 15) for each queue manager; you are recommended to use the minimal number of buffer pools consistent with the object and message type segregation outlined in Figure 9, and any data isolation requirements your application might have. Each buffer is 4 KB long. The maximum number of buffers is determined by the amount of storage available in the queue manager address space; do not use more than about 70% of the space for buffers. Usually, the more buffers you have, the more efficient the buffering and the better the performance of WebSphere MQ.

Figure 9 shows the relationship between messages, buffers, buffer pools, and page sets. A buffer pool is associated with one or more page sets; each page set is associated with a single buffer pool.

Figure 9. Buffers, buffer pools, and page sets

It is possible for an administrator to dynamically issue commands for modifying buffer pool size, numbers, and their association with page sets at any time (not just at queue manager restart), using the ALTER BUFFPOOL command.

If a buffer pool is too small, WebSphere MQ issues message CSQP020E. We can then dynamically add more buffers to the affected buffer pool (note that you may have to remove buffers from other buffer pools to do this).

You specify the number of buffers in a pool with the DEFINE BUFFPOOL command, and you dynamically resize buffer pools with the ALTER BUFFPOOL command. You determine the current number of buffers in a pool dynamically by displaying a page set that uses the buffer pool, using the DISPLAY USAGE command. These commands are described in the WebSphere MQ Script (MQSC) Command Reference manual.

For performance reasons, do not put messages and object definitions in the same buffer pool. Use one buffer pool (say number zero) exclusively for page set zero, where the object definitions are kept. Similarly, keep short-lived messages and long-lived messages in different buffer pools and therefore on different page sets, and in different queues.

The DEFINE BUFFPOOL command cannot be used after restart to create a new buffer pool. Instead, if a DEFINE PSID command uses the DSN keyword, it may explicitly identify a buffer pool that is not currently defined. That new buffer pool will then be created.