08.06.2014 Views

Download PDF (1.3 MB) - IBM Redbooks

Download PDF (1.3 MB) - IBM Redbooks

Download PDF (1.3 MB) - IBM Redbooks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4.14.6 Ensuring sufficient locking resources are available<br />

Locks are allocated from a common pool controlled by the locklist database level parameter,<br />

which is the number of 4000 pages set aside for this use. A second database level parameter,<br />

maxlocks, bounds the percentage of the lock pool held by a single application. When an<br />

application attempts to allocate a lock that exceeds the fraction allowed by maxlocks, or when<br />

the free lock pool is exhausted, DB2 performs lock escalation to replenish the supply of<br />

available locks. Lock escalation involves replacing many row locks with a single table-level<br />

lock.<br />

Although lock escalation addresses the immediate problem of lock-pool overuse or starvation,<br />

it can lead to database deadlocks and therefore should not occur frequently during normal<br />

operation. In some cases, application behavior can be altered to reduce pressure on the lock<br />

pool by breaking up large transactions that lock many rows into smaller transactions. It is<br />

simpler to try tuning the database first.<br />

Beginning with version 9, DB2 adjusts the locklist and maxlocks parameters automatically, by<br />

default. To tune these parameters manually, observe whether lock escalations are occurring<br />

either by examining the db2diag.log file or by using the system monitor to gather snapshots<br />

at the database level. If the initial symptom is database deadlocks, consider whether these<br />

deadlocks are initiated by lock escalations, as follows:<br />

1. Check the lock escalations count in the output.:<br />

db2 get snapshot for database <br />

2. Obtain current values for locklist and maxlocks by examining the output.:<br />

db2 get db config for <br />

3. If necessary, alter these values, for example, to 100 for locklist and 20 for maxlocks, as<br />

shown in Example 4-3.<br />

Example 4-3 Setting values for locklist and maxlocks<br />

db2 update db config for using locklist 100 maxlocks 20<br />

When increasing the locklist size, consider the impacts of the additional memory allocation<br />

that is required. Often, the locklist is relatively small compared with memory dedicated to<br />

buffer pools, but the total memory required must not lead to virtual memory paging.<br />

When increasing the maxlocks fraction, consider whether a larger value allows a few<br />

applications to drain the free lock pool. This drain might lead to a new cause of escalations as<br />

other applications needing relatively few locks encounter a depleted free lock pool. Often, a<br />

better way is to start by increasing locklist size alone.<br />

4.14.7 Setting boundaries on the size of the catalog cache for clustered<br />

applications<br />

The catalog cache is used to avoid repeating expensive activities, notably preparing execution<br />

plans for dynamic SQL. Therefore, an important consideration is to be sure that the cache is<br />

sized appropriately.<br />

By default, several 4 KB pages of memory are allocated for each possible application as<br />

defined by the MAXAPPLS database parameter. The multiplier is 4 for DB2 9, and 5 for<br />

DB2 9.5 and later. MAXAPPLS is AUTOMATIC, by default, and its value are adjusted to<br />

match the peak number of applications connected at run time.<br />

Chapter 4. Performance tuning and configuration 85

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!