common tuning opportunities i got the tee shirt andrew jepeal@compuware com
TRANSCRIPT
Common Tuning Opportunities
I got the tee shirt
Andrew Jepeal@compuware com
2Compuware Confidential
Common Tuning Opportunities
• COBOL• File I/O• CICS• DB2
3Compuware Confidential
COBOL - Table initialization
• Do we have to initialize?• Keeping a count of rows• Rewriting data anyway
• COBOL Initialize is fast
• Table to Table copy is fastest• 05 COBOL-TABLE-INIT
````````````````````````````````
100-MAIN
INITIALIZE COBOL-TABLE-INIT
````````````````````````````````````````````
MOVE COBOL-TABLE-INIT TO COBOL-TABLE-ORIGINAL
4Compuware Confidential
COBOL - Inspect verb
• It’s expensive
• It’s more expensive when using COBOL reserved words (low-values, spaces)
• Use a literal instead ‘ ‘
5Compuware Confidential
6Compuware Confidential
COBOL – Mismatched Data Types• In:
– Arithmetic
– Counters
– Compares
• Forces a conversion of working storage items, sometime multiple conversions
• Get the compile listing PMAP (pseudo assembler) and see exactly what’s going on.
7Compuware Confidential
File I/O - Buffering
• QSAM• We’re finding buffering isn’t helping anymore. The DASD and
Tape hardware are compensating for bad buffering & blksize(ymmv)
• VSAM • Sequential – data buffers (1/2*CIs per CA +1)• Direct
• Index buffers (Total CIs – Sequence set CIs +1)• Batch LSR (JCL or SMS) – advanced buffering, caches the
whole index and LRR data CIs.
8Compuware Confidential
File I/O – OPEN/CLOSE
• Repetitively opening and closing files
• SVC 19 & 20 (may also include SVCs 18,26,48,56,99,120, 130)
9Compuware Confidential
File I/O – Inserts
• High Wait Time and High CA splits• Is the input file sorted correctly?• Is the VSAM file in the right order?• It’s better to insert at the end of file.
10Compuware Confidential
File I/O – Read or update the same data
• Look at the number of EXCPs compared to number of records.
• Number of Logical Operations (read, update) vs. number of records
• We’ve seen very unusual numbers• Hundreds of thousands of reads to VSAM files that
contain a few thousand records• Batch LSR is a good band aid but fixing the logic is
the real solution.
11Compuware Confidential
CICS – Memory Management
• Module with Getmain / Freemain Descriptors• SVC 120• Use the CPU attribution report to determine what
modules / transactions are causing the modules to be invoked
12Compuware Confidential
CICS – Auxiliary Trace
• High CPU to Trace Domain modules(DFHTRPX)• We turn them on to debug a problem, then never
turn them off• They can be dynamically turned on/off (CETR)
13Compuware Confidential
CICS – Monitors
• High CPU time to modules associated with CICS monitors
• Monitors are not bad• Sometimes turning certain options on, is• Contact the Vendor to discuss
14Compuware Confidential
DB2 – Access Path
• Table Space scan generally bad
• # matching index columns vs predicates
• Stage 1 vs Stage 2 predicates
15Compuware Confidential
DB2 - Reading Data Repetitively
• Same as the File I/O, some programs read the same data over and over (reference data), rather than reading it once and storing locally.
• Will probably get a DB2 buffer hit so the SQL runs fast but still incur the CPU overhead of going to DB2
16Compuware Confidential
17Compuware Confidential
18Compuware Confidential
DB2 – Improper Cursor Usage
• Reading a whole table with singleton selects• Probably a place that a table space scan would be
better• The number or executions on the select matches the
number of rows in the table• Using a cursor when only one row is returned
• The number of Opens = the number of Fetches = the number of Closes
• Incurring the overhead of setting up a cursor when all or most of the time, only one row is returned
19Compuware Confidential
20Compuware Confidential
DB2 – Lack of Joins
• Especially in shops that migrated from IMS to DB2• Two or more separate SQL statement that are run
the exact same number of times• Look for common columns• Using the joins can significantly reduce the
number of calls to DB2
21Compuware Confidential
22Compuware Confidential
DB2 – Full Runstats
• Still see a lot of objects that do not have current Runstats, especially tables that have been set up for distributed application
• DB2 has gotten better in choosing the correct access path if you give it the right information to make the decision
23Compuware Confidential
24Compuware Confidential
DB2 – Compression
• See a lot of large tables without DB2 compression.
• It’s not your father’s compression
25Compuware Confidential
26Compuware Confidential
DB2 – Useless SQL
• Mostly in DB2 DDF• Thousands of executions in a 15 min period• Distributed app trying to keep a thread or
connection open ?• SELECT COUNT(*) FROM SYSIBM.SYSTABLES• SELECT CURRENT DATE FROM
SYSIBM.SYSDUMMY1
27Compuware Confidential
28Compuware Confidential
DB2 – Monitors
• PDT Modules – CA Detector