CM Analysis and uning of M cheduling sing PWF Rich ewis BM Dallas ystems Center Copyright BM Corporation, 1997 BM Corp., 1997 1
Abstract and rademarks CM Abstract cheduling in M ransaction Manager systems depends on many M parameters. hese parameters may have significant effects on the resources used to schedule transactions. his presentation provides an overview of scheduling and a review of scheduling parameters such as PARM, PRCM, WF, and PWF. t also presents a scheme for minimizing scheduling overhead by using Pseudo Wait-for-nput (PWF). his includes advice on calculating PARM and PRCM values, assigning classes, and determining the number of regions to use for each class. he presentation is based on M/EA 5.1 functions. he following are trademarks of nternational Business Machines Corporation. DB2 BM M M/EA ther products may be trademarks or registered trademarks of their respective companies. Dallas ystems Center BM Corp., 1997 2
Agenda CM verview of cheduling Parameters that Affect cheduling PARM, MAXR, PRCM, WF, PWF A cheme for Minimizing cheduling verhead teps to mplement the cheme Dallas ystems Center BM Corp., 1997 3
cheduling verview CM M actions associated with scheduling cheduling pathlength cheduling serialization (latching) Program loading (A/VF, Preload,...) Program housekeeping ubroutine loading DB2 thread creation/termination!!! Dallas ystems Center BM Corp., 1997 4
cheduling verhead CM "Measuring" overhead with the M Monitor DB2 hread Creation/ermination CREAE HRD and ERM HRD in Region WA, Program /, and Call ummary reports cheduling pathlength and serialization Mean times in cheduling + ermination sections of Region ummary reports Program load and program housekeeping ched. to 1st call/ched. in Program ummary reports Dallas ystems Center BM Corp., 1997 5
cheduling Parameters CM PARM MAXR PRCM WF PWF Dallas ystems Center BM Corp., 1997 6
PARM Parameter CM PARM Parameter on RAAC macro Requires CHDYP=PARAE on APPC macro Determines if transaction will be scheduled in another region f number on queue is greater than PARM times number of regions already scheduled, schedule another region RAAC CDE=X, PARM=2 Queue RA X RA X RA X RA X RA X MPR MPR MPR RA X RA X chedule another region Dallas ystems Center BM Corp., 1997 7
Choosing a value for PARM CM et PARM to minimize scheduling overhead while providing necessary internal response time Response time = ime waiting on queue <= PARM times avg. execution time or cheduling time plus Execution time Avg. execution time Dallas ystems Center BM Corp., 1997 8
Choosing a value for PARM CM f PARM is 'too low' we unnecessarily schedule programs which could have waited for an already scheduled region We waste our resources for no benefit! Dallas ystems Center BM Corp., 1997 9
Choosing a value for PARM... CM Resp. ime = (PARM x Avg. Exec. ime) + Avg. Exec. ime olving for PARM: PARM = (Resp. ime / Avg. Exec. ime) - 1 Acceptable response time = 1 sec. Avg. execution time = 0.2 sec. PARM = (1 / 0.2) - 1 = 4 Acceptable response time = 2 sec. Avg. execution time = 0.3 sec. PARM = (2 / 0.3) - 1 = 5 Acceptable response time = 2 sec. Avg. execution time = 0.1 sec. PARM = (2 / 0.1) - 1 = 19 Dallas ystems Center BM Corp., 1997 10
MAXR Parameter CM MAXR parameter on RAAC macro RAAC...MAXR=,... imits the number of MPP regions that may have the transaction concurrently scheduled f course, the number is also limited by the number of MPP regions which are eligible to schedule the transaction's class ften used to keep a "dog" transaction from occupying too many regions Dallas ystems Center BM Corp., 1997 11
PRCM Parameter CM PRCM parameter on RAAC macro RAAC...PRCM=(count,time),... Count determines if M will attempt to schedule another transaction in region when there are more of this transaction on the queue 65535 eliminates limit on # trans. processed f number of transactions processed by the region equals PRCM count, M may attempt to schedule another transaction in region sed to get a 'low priority' transaction out of region so a 'high priority' transaction may be processed High priority transactions should use 65535 Dallas ystems Center BM Corp., 1997 12
PRCM Parameter (cont.) CM Quick Reschedule Avoids unnecessary terminations and schedulings nvoked when PRCM count > 0 When PRCM count reached f same transaction would be rescheduled - Does not return 'QC' status code - Returns next message f same transaction would not be rescheduled - Returns 'QC' status code - Program terminates f PRCM count = 0 Quick Reschedule is disabled nly one transaction processed per schedule Dallas ystems Center BM Corp., 1997 13
Wait for nput (WF) CM What is WF? pecified on the system definition RAAC macro RAAC CDE=X,...,WF,... ack of message does not cause M to terminate program in region to -PCB will not return 'QC' status code nstead, waits for next message to arrive for the transaction sed to avoid scheduling overhead Dallas ystems Center BM Corp., 1997 14
Wait for nput (WF) (cont.) CM perations with WF WF transactions do not give up their regions Program terminated only by Reaching PRCM /P RAAC for MPP /PP RE reg# RAAC tran for BMP hutdown checkpoint of M system here must be enough regions for peak demand or perations must start and stop regions as required Dallas ystems Center BM Corp., 1997 15
Pseudo Wait for nput (PWF) CM What is PWF? pecified for the MPP region on JC // EXEC PM=DFRRC00,PARM='M,...,PWF=Y,...' Determines what M will do when there is nothing for a region to do: to -PCB will not return 'QC' status code nstead, waits for next message to arrive for the region f next message is the same transaction code, avoids termination and scheduling of transaction f next message is different transaction code, returns 'QC', terminates program, and schedules new one Dallas ystems Center BM Corp., 1997 16
PWF is elf uning CM ransaction tends to be scheduled in region which already has the tran. code scheduled n PWF wait f not already scheduled, tran. tends to be scheduled in unscheduled region Region not waiting and eligible for this class f tran. not already scheduled and all eligible regions are scheduled, region which has been idle longest is used All regions for this class are scheduled Dallas ystems Center BM Corp., 1997 17
elf uning Example CM f next tran is: A: given to region 1 B: given to region 2 C: waits for region 3 or given to region 4 Depends on PARM, number on queue, etc. D: schedules in region 4 Region 1 Region 2 Region 3 Region 4 ran. A waiting ran. B waiting ran. C executing noccupied Dallas ystems Center BM Corp., 1997 18
elf uning Example CM f next tran. is: A: given to region 1 B: given to region 2 C: waits for region 3 or given to region 1 or 2 Depends on PARM, number on queue, etc. D: waits for region 4 or given to region 1 or 2 Depends on PARM, number on queue, etc. E: schedules in region 1 or 2 chedules in region that has been waiting the longest Region 1 Region 2 Region 3 Region 4 ran. A waiting ran. B waiting ran. C executing ran. D executing Dallas ystems Center BM Corp., 1997 19
elf uning Rule CM A simple rule: When all regions are PWF and a transaction is x% of the volume, it will tend to occupy x% of the message regions for its class. mplication: he more PWF regions we have, the more scheduling overhead we avoid. Dallas ystems Center BM Corp., 1997 20
A Question CM Q: Can we do better than just having a lot of regions with one class? MPR MPR MPR MPR MPR MPR MPR MPR MPR MPR MPR MPR MPR MPR MPR MPR MPR A: t depends on our volumes by transaction. Dallas ystems Center BM Corp., 1997 21
A Better cheme CM ive each high-volume transaction its own class and its own dedicated region(s) Put low-volume transactions in 'shared' regions se 'shared' regions for 'overflow' of high-volume transactions ran X Class 1 ran X Class 1 ran Y Class 2 ran Z Class 3 Classes 4 and 1 Classes 4 and 2 Classes 4 and 3 Class 4 Class 4 Dallas ystems Center BM Corp., 1997 22
A Better cheme (cont.) CM ive each high-volume transaction its own class and its own dedicated region(s) se PWF for the regions Regions have only one class assigned to them Eliminates scheduling for dedicated regions Avoids having other transactions 'steal' the region(s) ran X Class 1 ran X Class 1 ran Y Class 2 ran Z Class 3 Classes 4 and 1 Classes 4 and 2 Classes 4 and 3 Class 4 Class 4 ------------ Dedicated Regions ------------ Dallas ystems Center BM Corp., 1997 23
A Better cheme (cont.) CM Put low-volume transactions in 'shared' regions se one (or few) classes for them his example uses class 4 for low-volume transactions ran X Class 1 ran X Class 1 ran Y Class 2 ran Z Class 3 Classes 4 and 1 Classes 4 and 2 Classes 4 and 3 Class 4 Class 4 ---------------- hared Regions ------------------- Dallas ystems Center BM Corp., 1997 24
A Better cheme (cont.) CM se 'shared' regions for 'overflow' of high-volume transactions verflow occurs when volumes are so high that the dedicated region(s) are not enough his is not practical with WF WF would never release the regions ------ verflow Regions ------ ran X Class 1 ran X Class 1 ran Y Class 2 ran Z Class 3 Classes 4 and 1 Classes 4 and 2 Classes 4 and 3 Class 4 Class 4 ------------------ hared Regions ----------------- Dallas ystems Center BM Corp., 1997 25
A Better cheme (cont.) CM For each high volume transaction Must know how many regions are needed Dedicated verflow ------- verflow Regions ------ ran X Class 1 ran X Class 1 ran Y Class 2 ran Z Class 3 Classes 4 and 1 Classes 4 and 2 Classes 4 and 3 Class 4 Class 4 ------------ Dedicated Regions ------------ ---------------- hared Regions ------------------- Dallas ystems Center BM Corp., 1997 26
he umber of Regions for a ran. CM How many dedicated regions are needed for a tran.? Enough to meet typical needs # Regions = (ypical tran. rate x Avg. exec. time) / Region occupancy Example: ypical tran. rate = 2 per second Avg. exec time = 0.4 seconds Region occupancy = 0.65 # regions = (2 x 0.4) / 0.65 = 1.23 = 2 (rounding up) Dallas ystems Center BM Corp., 1997 27
he umber of Regions for a ran. CM How many overflow regions are needed for a transaction? otal regions minus dedicated regions How many total regions are need for a transaction? Enough to meet peak needs # Regions = (Peak tran rate x Avg. exec. time) / Region occupancy Example: Peak tran. rate = 5 per second Avg. exec time = 0.4 seconds Region occupancy = 0.65 # regions = (5 x 0.4) / 0.65 = 3 Dallas ystems Center BM Corp., 1997 28
teps to mplement the cheme CM 1. rder transactions by volume 2. Adjust transactions for cost of scheduling 3. elect transactions for special classes 4. Calculate number of dedicated regions 5. Calculate number of overflow regions 6. Assign classes, PARM, and PRCM values 7. Create dependent regions with new classes Dallas ystems Center BM Corp., 1997 29
teps to mplement the cheme CM tep 1. rder transactions by volume ource of information: M Monitor ransaction Queuing report MPAR M og records nstallation reports Dallas ystems Center BM Corp., 1997 30
teps to mplement the cheme CM tep 2. Adjust transactions for cost of scheduling ources of information: M Monitor Call ummary report or Program / report Create hrd and erm. hrd Program ummary report ched. to First Call Adjust transaction volumes by giving extra weight to transactions using DB2 and/or having high 'ched. to First Call' times Dallas ystems Center BM Corp., 1997 31
teps to mplement the cheme CM tep 3. elect transactions for special classes a. Reorder transactions after weighting for DB2 and 'ched. to First Call' b. Eliminate transactions whose volumes are less than 1% of all transaction volumes c. elect up to 20 transactions Dallas ystems Center BM Corp., 1997 32
teps to mplement the cheme CM tep 4. Calculate number of dedicated regions # Regions = (ypical tran. rate x Avg. exec. time)/ Region occupancy ypical tran. rate - Avg. exec. time - M Monitor ransaction Queuing report M Monitor Program ummary report Region occupancy - 65% (rule of thumb) Dallas ystems Center BM Corp., 1997 33
teps to mplement the cheme CM tep 5. Calculate number of overflow regions # Regions = (Peak tran. rate x Avg. exec. time)/ Region occupancy ypical tran. rate - Avg. exec. time - M Monitor ransaction Queuing report from peak time or 2 times average rate (rule of thumb) M Monitor Program ummary report Region occupancy - 65% (rule of thumb) Dallas ystems Center BM Corp., 1997 34
teps to mplement the cheme CM tep 6. Assign classes, PARM, and PRCM values For selected transactions, a. Assign unique classes on their RAAC macros b. Calculate PARM values PARM = (Response time/avg. Exec. ime) - 1 Response time = 1 to 2 seconds (installation dependent) Avg. Exec. ime - M Monitor Program ummary report c. et PRCM = 65535 Dallas ystems Center BM Corp., 1997 35
teps to mplement the cheme CM tep 7. Create dependent regions with new classes For selected transactions, a. Create dedicated regions Each will have one new class b. Create overflow regions Each will have a shared class and one new class For other transactions, a. Create or maintain shared regions Each will have one or more shared classes Dallas ystems Center BM Corp., 1997 36
Benefits of the cheme CM Avoids unnecessary overhead Dynamically adjusts to changing volumes Provides the required response times Dallas ystems Center BM Corp., 1997 37
ummary CM cheduling may produce unnecessary overhead Especially with DB2 thread creation/termination cheduling overhead may be controlled PWF may be used to minimize overhead PARM may be calculated umbers of regions may be calculated Data is available for the calculations Dallas ystems Center BM Corp., 1997 38