2
<!--Copyright 1997-2002 by Sleepycat Software, Inc.-->
3
<!--All rights reserved.-->
4
<!--See the file LICENSE for redistribution information.-->
7
<title>Berkeley DB Reference Guide: Configuring locking</title>
8
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
9
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
12
<a name="2"><!--meow--></a>
13
<table width="100%"><tr valign=top>
14
<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Locking Subsystem</dl></h3></td>
15
<td align=right><a href="../../ref/lock/intro.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/lock/max.html"><img src="../../images/next.gif" alt="Next"></a>
18
<h1 align=center>Configuring locking</h1>
19
<p>The <a href="../../api_c/env_set_lk_detect.html">DB_ENV->set_lk_detect</a> method specifies that the deadlock detector
20
should be run whenever a lock is about to block. This option provides
21
for rapid detection of deadlocks at the expense of potentially frequent
22
invocations of the deadlock detector. On a fast processor with a highly
23
contentious application where response time is critical, this is a good
24
choice. An option argument to the <a href="../../api_c/env_set_lk_detect.html">DB_ENV->set_lk_detect</a> method
25
indicates which lock requests should be rejected.
26
<p>In general, when applications are not specifying lock and transaction
27
timeout values, the <a href="../../api_c/env_set_lk_detect.html#DB_LOCK_DEFAULT">DB_LOCK_DEFAULT</a> option is probably the
28
correct first choice, and other options should only be selected based
29
on evidence that they improve transaction throughput. If an application
30
has long-running transactions, <a href="../../api_c/env_set_lk_detect.html#DB_LOCK_YOUNGEST">DB_LOCK_YOUNGEST</a> will guarantee
31
that transactions eventually complete, but it may do so at the expense
32
of a large number of lock request rejections (and therefore, transaction
34
<p>The alternative to using the <a href="../../api_c/env_set_lk_detect.html">DB_ENV->set_lk_detect</a> interface is
35
to explicitly perform deadlock detection using the Berkeley DB
36
<a href="../../api_c/lock_detect.html">DB_ENV->lock_detect</a> interface.
37
<p>The <a href="../../api_c/env_set_lk_conflicts.html">DB_ENV->set_lk_conflicts</a> method allows you to specify your own
38
locking conflicts matrix. This is an advanced configuration option,
39
and is almost never necessary.
40
<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/lock/intro.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/lock/max.html"><img src="../../images/next.gif" alt="Next"></a>
42
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>