db2 GET RECOMMENDATIONS FOR HEALTH INDICATOR db.deadlock_rate
db2 GET DESCRIPTION FOR HEALTH INDICATOR db.deadlock_rate
$ db2 GET DESCRIPTION FOR HEALTH INDICATOR db.deadlock_rate
DESCRIPTION FOR db.deadlock_rate
Deadlock rate tracks the rate at which deadlocks are occurring in
the database and the degree to which applications are experiencing
contention problems. Deadlocks may be caused by the following
situations:
o Lock escalations are occurring for the database
o An application may be locking tables explicitly when system-
generated row locks may be sufficient
o An application may be using an inappropriate isolation level
when binding
o Catalog tables are locked for repeatable read
o Applications are getting the same locks in different orders,
resulting in deadlock.
The indicator is calculated using the formula: (db.deadlocks<t> -
db.deadlocks<t-1>) where 't' is the current snapshot and 't-1' is
the last snapshot "5" "minutes" ago. A high rate of deadlocks results in
a greater degree of contention which may generate an alert.
$ db2 GET RECOMMENDATIONS FOR HEALTH INDICATOR db.deadlock_rate
Recommendations:
Recommendation: Investigate current deadlocks.
One of more applications may be holding a large number of locks.
Consider tuning these applications to reduce the number of locks
required.
Take one of the following actions:
Launch DB2 tool: Event Monitor
The event monitor can be used to capture and analyze database events
such as deadlocks.
To open the Create Event Monitor window:
1. From the Control Center, expand the object tree until you find
the Event Monitors folder.
2. Right-click the Event Monitors folder and click Create in the
pop-up menu. The Create Event Monitor window opens.
Enter an event monitor name in the Name field. Click OK to create
the deadlock event monitor.
Recommendation: Investigate application concurrency.
The applications executing against the database may not be capable
of running concurrently, or may not be designed properly to handle
concurrent operation with other applications.
Take one of the following actions:
Launch DB2 tool: Activity Monitor
The Activity Monitor provides a set of predefined reports to assist
a DBA in monitoring application performance and concurrency, resource
consumption, and SQL statement usage of a database or database
partition. The Activity Monitor also provides recommendations to help
a DBA to diagnose the cause of database performance problems, and to
tune queries for optimal utilization of database resources.
To open the Activity Monitor:
1. From the Control Center, expand the object tree until you find
the database that you want.
2. Right-click the database, and click Activity Monitor in the
pop-up menu. The Activity Monitor opens.
To start the Activity Monitor from the command line issue the db2am
command.
Use the Set Up Activity Monitor wizard to create a monitoring task
to generate reports on lock usage at the application level. The lock
usage data includes information about the number of locks held by
each application, the lock wait start time and the total number of
deadlocks per application. The application lock chains also displays
the lock wait dependencies for a given application.
Examine the applications to see if they are capable of running
concurrently. If it is determined that the applications in which
the deadlocks are occurring are capable of running concurrently,
consider modifying one or more of the applications to reduce
contention problems. Contention problems may be caused by the
following situations:
o Lock escalations are occurring for the database.
o An application may be locking tables explicitly when
system-generated row locks may be sufficient.
o An application may be using an inappropriate isolation level
when binding.
o Catalog tables are locked for repeatable read.
o Applications are getting the same locks in different orders,
resulting in deadlock.
作者“IT技術博客”