Selection priorities for transactions in DB/DC and DCCTL environments
When more than one transaction of a given type is waiting to be scheduled, the specified transaction scheduling priority determines which transaction code is selected. It does not determine which transaction is scheduled. Only the tests of the transaction's readiness for scheduling, which occur after selection, determine if the transaction queue is allocated to an application program.
Selection priorities are useful for influencing the response time to input transactions and for load balancing. Two priorities can be specified:
- Normal priority
- Limit priority
Related to the normal and limit priorities is the limit count. When the number of input messages of a specific transaction type waiting to be scheduled is equal to or greater than the limit count, the normal priority is reset to the limit priority value.
The priority of a transaction code causes it to be selected either before or after other transaction codes. You specify the numeric priority with the PRTY keyword of the TRANSACT macro. Values can be selected in the range 0 - 14; a value of 0 specifies the transaction is not eligible for automatic scheduling. If multiple transaction codes are at the same priority, they are selected on a first-in/first-out basis. So, if multiple transaction codes are at the same priority and class, with many messages already enqueued for each transaction code, the first scheduled transaction code processes all of its messages before the next, equal priority, and class transaction code are scheduled.
You can raise the priority normally used for a transaction after a certain level of the queue is reached. In this way, you can give the transaction an increased chance of being scheduled. Another case occurs when a program requires significant program loading time or initialization and is then followed by a batch-like processing of a group of transactions.
It is possible that more messages are added to the queue while the transaction is waiting or in process at the limit priority. The normal priority is not restored until all messages enqueued on the transaction code are processed. The priorities are selection priorities, not execution priorities. After a transaction has been selected for scheduling, the selection priorities have no influence until it is again recognized to be waiting for scheduling.
Limit priority can be in the range 0 - 14. Limit count has a default of 65535 and a valid range of 1 to 65535. You specify limit priority and the queue count as the second and third parameters of the PRTY keyword on the TRANSACT macro. If you do not require this priority override technique, code the limit priority equal to the normal priority, and code the limit count as 65535.
Another way to use the selection priorities is to declare a normal
priority value of zero. Zero priority is a null or not eligible
for scheduling
level. Messages accumulate until the limit count
is reached; limit priority takes effect and the message is eligible
for scheduling. This technique is called batching messages.
The effectiveness of the selection priority assignments is related to how frequently the selection process occurs.