eG Monitoring
 

Measures reported by Db2DPFLocksTest

Typically, locking activity is governed by the following factors:

  • Concurrency and granularity
  • Lock compatibility
  • Lock conversion
  • Lock escalation
  • Lock waits and timeouts
  • Deadlocks

This test monitors the locking activity on the DB2 database server and reports critical statistics that will enable administrators to accurately determine what has caused a significant dip in application performance.

The measures made by this test are as follows:

Measurement Description Measurement Unit Interpretation
Locks_held Indicates the total number of locks currently held by all applications in this partition of this database. Number  
Lock_escalations Indicates the number of times every second that locks have been escalated from several row locks to a table lock. A lock is escalated when the total number of locks held by an application reaches the maximum amount of lock list space available to the application, or the lock list space consumed by all applications is approaching the total lock list space. The amount of lock list space available is determined by the maxlocks and locklist configuration parameters. When an application reaches the maximum number of locks allowed and there are no more locks to escalate, it will then use space in the lock list allocated for other applications. When the entire lock list is full, an error occurs. This data item includes a count of all lock escalations, including exclusive lock escalations. Number

There are several possible causes for excessive lock escalations:

  • The lock list size (locklist) may be too small for the number of concurrent applications.

  • The percent of the lock list usable by each application (maxlocks) may be too small.

  • One or more applications may be using an excessive number of locks.

To resolve these problems, you may be able to:

  • Increase the locklist configuration parameter value.

  • Increase the maxlocks configuration parameter value.

Identify the applications with large numbers of locks or those that are holding too much of the lock list. These applications can also cause lock escalations in other applications by using too large a portion of the lock list. These applications may need to resort to using table locks instead of row locks, although table locks may cause an increase in Lock_waits and Avg_lock_wait_time measures.

Exclusive_lock_escalations Indicates the number of times per second that locks have been escalated from several row locks to one exclusive table lock, or the number of times (per second) an exclusive lock on a row caused the table lock to become an exclusive lock. Number

Other applications cannot access data held by an exclusive lock; therefore it is important to track exclusive locks since they can impact the concurrency of your data.

A lock is escalated when the total number of locks held by an application reaches the maximum amount of lock list space available to the application. The amount of lock list space available is determined by the locklist and maxlocks configuration parameters. When an application reaches the maximum number of locks allowed and there are no more locks to escalate, it will then use space in the lock list allocated for other applications. When the entire lock list is full, an error occurs. See Lock_escalations for possible causes and resolutions to excessive exclusive lock escalations. An application may be using exclusive locks when share locks are sufficient. Although share locks may not reduce the total number of lock escalations share lock escalations may be preferable to exclusive lock escalations.

Lock_timeouts Indicates the number of times that a request to lock an object timed-out instead of being granted Number This measurement can help you adjust the setting for the locktimeout database configuration parameter. If the number of lock time-outs becomes excessive when compared to normal operating levels, you may have an application that is holding locks for long durations. In this case, this element may indicate that you should analyze some of the other lock and deadlock monitor elements to determine if you have an application problem. You could also have too few lock time-outs if your locktimeout database configuration parameter is set too high. In this case, your applications may wait excessively to obtain a lock.
Lock_waits Indicates the total number of times per second that applications or connections in this partition waited for locks. Waits/Sec If the value is consistantly high, find out the applications or connections causing lock waits and fine tune the appropriate SQL queries.
Avg_lock_wait_time Indicates the average time that all the applications in this partition were waiting for a lock. Seconds If the average lock wait time is high, you should look for applications that hold many locks, or have lock escalations, with a focus on tuning your applications to improve concurrency, if appropriate.
Pct_appl_in_lock_wait Indicates the percentage of applications in this partition waiting for the release of a lock. Percent If this value is high, the applications may have concurrency problems, and you should identify applications that are holding locks or exclusive locks for long periods of time.
Deadlocks Indicates the total number of deadlocks that have been detected per second in this partition. Deadlocks/Sec This element can indicate that applications are experiencing contention problems. These problems could be caused by the following situations:
  1. Lock escalations are occurring for the database

  2. An application may be locking tables explicitly when system-generated row locks may be sufficient.

  3. An application may be using an inappropriate isolation level when binding

  4. Catalog tables are locked for repeatable read

  5. Applications are getting the same locks in different orders, resulting in deadlock

You may be able to resolve the problem by determining in which applications (or application processes) the deadlocks are occurring. You may then be able to modify the application to better enable it to execute concurrently. Some applications, however, may not be capable of running concurrently.