Using the locking services
In Net Search Extender, there are different types of locks that control concurrent
access to an index. The different locks depend on whether the text index is
only being read, as in the case of a search request, or if changes to the
text index need to be computed and subsequently written to files.
During db2text start, the locking services automatically start.
There are the following types of locks on a text index:
- S-lock
- For shared read-only access. For example, search requests.
- U-lock
- For read and write access while computing changes to an index (update)
with concurrent read access. For example, search requests.
- X-lock
- For exclusive read/write access for a short period during
which changes are actually written to the index.
- IX-lock
- For intended exclusive read/write access preventing any
new S-locks while the update process is waiting for an X-lock.
There is one Net Search Extender locking service per DB2 instance. The locking service
maintains the locks for multiple databases.
The locking services configuration file is db2extlm.cfg. It is
stored on <instance_owner_home>/sqllib/db2ext for UNIX systems
and on <sqllib>\<DB2INSTANCE>\db2ext for Windows.
Changes to the configuration file only take effect when Net Search Extender
Instance Services are started during db2text start. See CONTROL for
further information. The user can set the following values:
- The maximum number of databases
- The maximum number of indexes per database
- The maximum number of allowed locks (concurrent users) per index
- Waiting times and the number of attempts to obtain a lock
The default values of the configuration file are as follows:
<default
maxDbs = " 8"
maxIdxPerDb = " 50"
maxLocksPerIdx = "100"
sWait = " 50"
uWait = " 500"
xWait = " 500"
sAttempt = "50"
uAttempt = "10"
xAttempt = "60"
latchTimeout = "80"
/>
The syntax is <default attribute=value.../> and the attributes
have the following meanings:
- maxDbs
- The number of databases the locking services can handle (integer >1).
- maxIdxPerDb
- The number of indexes per database that can be locked
(integer >1). This value is the same for all databases.
- maxLocksPerIdx
- The number of locks that can simultaneously exist on an index (integer
>1). This value is the same for all indexes.
- sWait/sAttempt
- When requesting an S-lock, sAttempt is the number of attempts that are
made if the lock is not granted immediately. sWait is the waiting time between
these attempts (integer >1). These parameters also apply to IX-locks.
- uWait/uAttempt
- When requesting a U-lock, uAttempt is the number of attempts that are
made if the lock is not granted immediately. uWait is the waiting time between
these attempts (integer >1).
- xWait/xAttempt
- When requesting an X-lock, xAttempt is the number of attempts that are
made if the lock is not granted immediately. xWait is the waiting time between
these attempts (integer >1).
- latchTimeout
- This is additional waiting time for interval locking services. To determine
the total waiting time for a lock, use the following calculation:
waiting time = # attempts * (# waits + (2 * # latchTimeout))
The waiting time is calculated in milliseconds. Note that with each
attempt, the latchTimeout value is doubled when added to the
overall waiting time.