MQGET options and read ahead
Not all MQGET options are supported when read ahead is enabled; some options are required to be consistent between MQGET calls.
When you call MQOPEN with MQOO_READ_AHEAD, the IBM MQ client only enables read-ahead if certain conditions are met. These conditions include:- Both the client and remote queue manager must be at IBM WebSphere MQ Version 7.0 or later.
- The client application must be compiled and linked against the threaded IBM MQ MQI client libraries.
- The client channel must be using TCP/IP protocol
- The channel must have a non-zero SharingConversations (SHARECNV) setting in both the client and server channel definitions.
The following table indicates which options are supported for use with read ahead and whether they can be altered between MQGET calls.
MQGET values and options | Permitted when read ahead is enabled and can be altered between MQGET calls 5 | Permitted when read ahead is enabled but cannot be altered between MQGET calls 1 | MQGET Options that are not permitted when read ahead is enabled 2 |
---|---|---|---|
MQGET MQMD values |
MsgId 3 CorrelId 3 |
Encoding CodedCharSetId |
|
MQGET MQGMO Options |
|
|
|
- If these options are altered between MQGET calls, an MQRC_OPTIONS_CHANGED reason code is returned.
- If these options are specified on the first MQGET call then read ahead is disabled. If these options are specified on a subsequent MQGET call a reason code MQRC_OPTIONS_ERROR is returned.
- If a client application alters MsgId and CorrelId values between MQGET calls, messages with the previous values might already have been sent to the client and will remain in the client read ahead buffer until consumed (or automatically purged).
- MQGMO_MSG_UNDER_CURSOR is not possible with read ahead. Read ahead is disabled when both MQOO_BROWSE and one of the MQOO_INPUT_SHARED or MQOO_INPUT_EXCLUSIVE options are specified when opening the queue.
- When read ahead is enabled, the first MQGET determines whether messages are to be browsed or got from a queue. If the client application then uses MQGET with changed options, such as attempting to browse following an initial get, or attempting to get following an initial browse, an MQRC_OPTIONS_CHANGED reason code is returned.
If a client alters its selection criteria between MQGET calls, messages being stored in the read ahead buffer that match the initial selection criteria are not consumed by the client application, and remain stranded in the client read ahead buffer. In situations where the client read ahead buffer contains many stranded messages, the benefits associated with read ahead are lost and a separate request to the server is required for each message consumed. To determine whether read ahead is being used efficiently we can use the connection status parameter, READA.
Read ahead can be inhibited when requested by an application due to incompatible options specified on the first MQGET call. In this situation the connection status shows read ahead as being inhibited.
If, because of these restrictions on MQGET, you decide that a client application design is not suited to read ahead, specify the MQOPEN option MQOO_READ_AHEAD_NO. Alternatively set the default read ahead value of the queue being opened altered to either NO or DISABLED.
Parent topic: Improving performance of non-persistent messages