How to reduce false contention

Several tips and recommendations can help you reduce false contention.

The following tips can help you reduce false contention:
  • As much as possible, reduce the amount of real lock contention in your applications.
  • Specify a larger size for the lock structure and manually rebuild it.
  • Ensure that the value for LOCK ENTRY SIZE is not too large for the number of members in your group.

    The LOCK ENTRY SIZE parameter for the first IRLM to join the group determines the size of each lock entry in the lock table.

    A lock entry size of 2 allows twice as many lock entries as a lock entry size of 4, as illustrated in the figure below.

    Figure 1. Initial lock entry size
    Begin figure description. A lock table with an initial allocation of 2-byte lock entries can hold twice the number of entries as another with an initial allocation of 4-byte. End figure description.

    IRLM automatically rebuilds the structure when it needs to. For example, assume MAXUSRS is set to 7. When the 8th member joins the group, IRLM automatically rebuilds the lock structure to create the 4-byte lock entries to handle up to 23 members. IRLM automatically rebuilds the lock structure again when the 24th member joins the group, to create 8-byte lock entries to handle up to 32 members.

    For this reason, even if you anticipate your group growing beyond seven members, you can start out with a lock entry size of 2 make the most efficient use of lock structure storage.

    Recommendation: Set MAXUSRS for all IRLM instances to an appropriate value for the number of members that you expect to have in a data sharing group. For example, if you plan to have 8–23 members in your data sharing group on a regular basis, you should set MAXUSRS=23 in the IRLMPROC procedure for the IRLM instance that is associated with each member of the data sharing group. Alternatively, you can set the LOCK ENTRY SIZE field value to 4 in installation panel DSNTIPJ when you install each member of the data sharing group. Doing this causes the Db2 installation process to set the MAXUSRS value to 23 in the associated IRLMPROC procedures. Lock structure allocation occurs when the first member joins the data sharing group after an IPL of the operating system, or after any situation that causes the lock structure to be deallocated.

    If you initially set MAXUSRS=23 for all IRLM instances, the lock structure size is already adequate for up to 23 members, no matter which IRLM is the first to connect. A lock structure rebuild is not necessary when the eighth member joins the group.

    If you increase the lock entry size (and thereby increase MAXUSRS), increase the lock structure size, to maintain the number of lock table entries and record list entries. If you do not increase the lock structure size, IRLM obtains the storage that it needs for the increased lock entry size from storage for lock table entries or record list entries.

  • Start of changeUsing locking protocol 2 results in reduced XES global contention, which can reduce false IRLM lock contention for parent L-locks when you request lock modes IS or IX. Locking protocol 2 reduces overhead from data sharing processing but might increase child lock propagation to the lock structure in the coupling facility. Propagation is based on the page set P-lock instead of the parent L-lock.

    If a data sharing group uses locking protocol 1, and you want to enable locking protocol 2, you must first quiesce that data sharing group. To activate locking protocol 2, you must initiate a group-wide shutdown. The restart of the first member after a group-wide shutdown changes the group protocol level from 1 to 2.

    To determine whether locking protocol 2 is enabled, issue the DISPLAY GROUP command.

    End of change