+ All Categories
Home > Documents > Analytic modelling of locking protocols in database systems

Analytic modelling of locking protocols in database systems

Date post: 19-Sep-2016
Category:
Upload: s-l
View: 214 times
Download: 2 times
Share this document with a friend
7
Analytic modelling of locking protocols in database systems K.-W. Lam and S:L. Hung Abstract: The consistency of the database for concurrent transaction processing in database systems is guaranteed by concurrency control protocols which are normally implemented by two phase locking. Queuing network models are used to study two important locking protocols namely, the static and dynamic two phase locking protocols. Using simple combinatorial arguments and elementary probability theory, an efficient way of deriving expressions is provided for quantities such as the blocking delays of transactions, the probability of a lock being granted and the probability of deadlocks. Mean value analysis is then applied to the two models. The analysis is straightforward and the models are easy to understand. The analytic results show remarkable good agreement with simulation results. Some conclusions are drawn regarding the performance of locking protocols in the database systems. 1 Introduction Two-phase locking (2PL) has been accepted as a standard approach to the problem of concurrency control. Basically, the basic 2PL consists of two phases: in the growing phase a transaction has to lock a data item before it accesses the data item, and in the shrinking phase, once a transaction releases a lock it may never request new locks. Under 2PL, transactions can be recoverable and free from cascading aborts [I]. Two important variants of 2PL are static and dynamic schemes [2, 31. In static two-phase locking (S2PL), all the requested data granules should be locked before the transaction is processed. A granule is the lockable unit of data. The transaction can set locks only when all its requested locks are not in conflict with other transactions. Transactions release all their locks at the end of their execution. As cyclic-wait for data granules locks is not possible, this protocol is completely free from deadlocks. In the dynamic two-phase locking (D2PL), transactions acquire locks to access data granules one at a time on demand and release all the locks, like S2PL, at the end of their executions. Transactions are blocked when the requested data granule is being held by another transaction. Transactions may even be involved in deadlocks in which case each transaction is waiting for one of the others to release a lock and some deadlock resolution methods have to he implemented [l]. Several studies [4-91 have been done on the effect of 2PL on the performance of database systems using analytic techniques. The performance of B database system is affected by resources contention (contention for hardware) and data contention (in the form of locks) due to concur- &? IEE, 1999 IEE Proceedings online no. 19990190 DOI: IO. 10491ip-edt:19990 I90 Paper first received 15th August 1997, and in revised form 23rd November 1998 The authors are with Department of Computer Science, City Univeisity of Hong Kong, 83 Tat Chee Avenuc, Kowloon, Hong Kong E-mail: kwlam~~s.cityu.edu.hk IEE Proc.-Compul. Digit. Tech., Yo;. 146, No. 3. Muy 1999 rency control protocols (CCP) to ensure the consistency of the database accessed by concurrent transactions [3]. We devise an efficient approach to analytic modelling of the performance of centralised database systems under S2PL and D2PL. By using simple combinatorial argu- ments, probability theory and exact mean value analysis (MVA) algorithm [lo] in the analysis of the two models, we show that some assumptions made in the previous studies [2, 41 can be relaxed. 2 Definitions, assumptions and performance measures 2.7 Definifions The following are the definitions of the parameters for the two models in this paper. N DS TS NG TCPU TCH TSET TREL TI01 TI02 TRRE TDET NL degree of multiprogramming (MPL) database size, i.e. total number of data items in database transaction size, i.e. total number of data items accessed by a transaction total number of granules in database, i.e. lockable unit of data mean total CPU time spent on a transaction for usehl computations mean total CPU time spent on a transaction for processing lock request mean total CPU time spent on a transaction for setting locks mean total CPU time spent on a transaction for releasing locks on completion mean total I10 time on disc unit 1 spent on a transaction for accessing database mean total I10 time on disc unit 2 spent on a transaction for accessing database mean total CPU time spent on a transaction for releasing locks upon restart to break a deadlock mean CPU time spent on each deadlock detection total number of granules accessed by a transaction 161
Transcript

Analytic modelling of locking protocols in database systems

K.-W. Lam and S:L. Hung

Abstract: The consistency of the database for concurrent transaction processing in database systems is guaranteed by concurrency control protocols which are normally implemented by two phase locking. Queuing network models are used to study two important locking protocols namely, the static and dynamic two phase locking protocols. Using simple combinatorial arguments and elementary probability theory, an efficient way of deriving expressions is provided for quantities such as the blocking delays of transactions, the probability of a lock being granted and the probability of deadlocks. Mean value analysis is then applied to the two models. The analysis is straightforward and the models are easy to understand. The analytic results show remarkable good agreement with simulation results. Some conclusions are drawn regarding the performance of locking protocols in the database systems.

1 Introduction

Two-phase locking (2PL) has been accepted as a standard approach to the problem of concurrency control. Basically, the basic 2PL consists of two phases: in the growing phase a transaction has to lock a data item before it accesses the data item, and in the shrinking phase, once a transaction releases a lock it may never request new locks. Under 2PL, transactions can be recoverable and free from cascading aborts [I] .

Two important variants of 2PL are static and dynamic schemes [2, 31. In static two-phase locking (S2PL), all the requested data granules should be locked before the transaction is processed. A granule is the lockable unit of data. The transaction can set locks only when all its requested locks are not in conflict with other transactions. Transactions release all their locks at the end of their execution. As cyclic-wait for data granules locks is not possible, this protocol is completely free from deadlocks. In the dynamic two-phase locking (D2PL), transactions acquire locks to access data granules one at a time on demand and release all the locks, like S2PL, at the end of their executions. Transactions are blocked when the requested data granule is being held by another transaction. Transactions may even be involved in deadlocks in which case each transaction is waiting for one of the others to release a lock and some deadlock resolution methods have to he implemented [l].

Several studies [4-91 have been done on the effect of 2PL on the performance of database systems using analytic techniques. The performance of B database system is affected by resources contention (contention for hardware) and data contention (in the form of locks) due to concur-

&? IEE, 1999 IEE Proceedings online no. 19990190 DOI: IO. 10491ip-edt: 19990 I90 Paper first received 15th August 1997, and in revised form 23rd November 1998 The authors are with Department of Computer Science, City Univeisity of Hong Kong, 83 Tat Chee Avenuc, Kowloon, Hong Kong E-mail: kwlam~~s.cityu.edu.hk

IEE Proc.-Compul. Digit. Tech., Yo;. 146, No. 3. Muy 1999

rency control protocols (CCP) to ensure the consistency of the database accessed by concurrent transactions [3].

We devise an efficient approach to analytic modelling of the performance of centralised database systems under S2PL and D2PL. By using simple combinatorial argu- ments, probability theory and exact mean value analysis (MVA) algorithm [lo] in the analysis of the two models, we show that some assumptions made in the previous studies [2, 41 can be relaxed.

2 Definitions, assumptions and performance measures

2.7 Definifions The following are the definitions of the parameters for the two models in this paper.

N DS

TS

NG

TCPU

TCH

TSET

TREL

TI01

TI02

TRRE

TDET NL

degree of multiprogramming (MPL) database size, i.e. total number of data items in database transaction size, i.e. total number of data items accessed by a transaction total number of granules in database, i.e. lockable unit of data mean total CPU time spent on a transaction for usehl computations mean total CPU time spent on a transaction for processing lock request mean total CPU time spent on a transaction for setting locks mean total CPU time spent on a transaction for releasing locks on completion mean total I10 time on disc unit 1 spent on a transaction for accessing database mean total I10 time on disc unit 2 spent on a transaction for accessing database mean total CPU time spent on a transaction for releasing locks upon restart to break a deadlock mean CPU time spent on each deadlock detection total number of granules accessed by a transaction

161

HL

D,, Ddul Dhca Dbqs

Dd13

X

half of total number of granules accessed by a transaction service demand of a transaction at CPU service demand of a transaction at disc unit 1 service demand of a transaction at disc unit 2 service demand of a transaction at block queue server (BQS) service demand of a transaction at delay server (DLS) system throughput, i.e. transactions per second

2.2 Assumptions The following basic assumptions will be applied into the two models:

(i) Each granule lock is an exclusive lock (ii) The lock table is entirely maintained in the main memory, This implies that there is no VO time spent on processing locks. (iii) The granule locks requested by a transaction are distinct and uniformly distributed over the available gran- ules in the database. (iv) In determining NL for each transaction it is assumed that transactions access data items randomly and the data items are fully packed in granules as far as possible for the same transaction. The number of granules to be accessed by a transaction can be therefore calculated by NI. = TS* NGIDS ~ ~~~~

(v) The queuing network model is based on the BCMP model [IO].

2.3 Performance measures In the evaluation of the two models, the effect of transac- tion size, database granularity, degree of multiprogram- ming on the performance measures, system throughput, residence time and block queue delay would be studied. The system parameter values have been chosen for the two analytic models as follows:

DS = 5000 data items TCPU= 50*TS ms TCH =5*NL ms

TREL = 1O*NL ms TI01 =25*TS ms TI02 =25*TS ms TRRE = 5*NL ms TDEL = 10*N ms

TSET =5*NL ms

D,, = TCPU+ TCH+ TSET+ TREL =SO*TS+20*NL for S2PL model

D,, =TCPU+TCH+TSET+TREL+TRRE+TDEL =50*TS+2S*NL+ 10*N for D2PL model

D,, = TI01 D,, = TI02

3 Static two-phase locking model

The queuing network model for the database system using S2PL is shown in Fig. 1. The model has three service centres: the CPU for processing computations and locking overheads, disc units for accessing data items in the database and a block queue server BQS) for handling transactions failing to obtain their granule locks. Their service disciplines are modelled to be processor sharing, first-come-first-served and infinite server [lo], respectively.

162

L Fig. 1 Queuing network modelfor SZPL and DZPL

The two MPL switches, deallocate switch and allocate switch are used to control the degree of multiprogramming level.

The BQS is a pseudoserver associated with no physical resources which is used to model the waiting time of a blocked transaction for its locks. Thus, BQS is a delay centre where each transaction gets service immediately with a service demand equal to the mean waiting time for the average transaction getting its locks. Note that the delay server is not used in the S2PL model; it will be used in the D2PL model which we explain in Section 4.

In applying the MVA technique, only service demands of transactions at the service centres are needed as the input to the model. The only unknown is the service demand at the BQS which has to be determined. The BQS is here used to model transaction’s contention for data. To make the model conceptually simple and the analysis tractable, data contention and resources contention are not separated. It is also assumed that the model is in equilibrium and that only steady-state values for the vari- ables are used.

When Little’s law [lo] is applied to the BQS, the transaction’s service demand Dbqs at the block queue is given by Dbqs = Nbys/X, where Nbqs is the mean number of the blocked transactions in the system and X i s the system throughput. To determine Dbqs, Nbqs and X have to he obtained. When k transactions are active, the number of granules being locked is P N L (NL is the number of locks per transaction). Let B(k) be the probability that a new transaction Twill be blocked. Given k transactions being active, B(k) can be calculated as follows.

For T to be blocked, at least one or more of its requested granules must be within the set of data granules locked by other transaction in the system. The total number of possible ways for a transaction T to be blocked is

NG - ~ * N L ) * ( k * y ) +, NL - i

where NG is the total number of granules in the database, and B(k) is

where the denominator is the number of ways for T to choose its NL granule. To compute Nbqs one has to obtain P(blm) which is the probability that exactly b transactions are blocked given that m transactions have entered the system. There are only two possible ways for this to occur

-the newly-entered mth transaction is blocked when m - 1 transactions are in a system in which b ~ 1 transactions have been blocked

IEE Pmc.-Comput. Digit. Tech., W. 146, No. 3, May 1999

-the newly-entered mth transaction is active when m - 1 transactions are in a system in which b transactions have been blocked.

Thus, the following recurrence relation holds

P(blm) = P(b - l)lm - I)’B(m - b) + P(blm - I)’[[ - B(m - b - l)]

Since there exists no deadlock for S2PL and at least one transaction in the system being active, the following boundary conditions must he satisfied P(O10) = 1 and m > b > = 0. The mean number of blocked transactions at the BQS can he obtained by the equation:

where N is the degree of multiprogramming (MPL). Dbqs is expressed in terms of system throughput X which can only he known after the model has been evaluated. An iterative approach is adopted. An arbitrary value is chosen for system throughput X to determine the value of Dbqs, which is then substituted into the exact MVA model, generates a new computed value for the X. This new value of X is in turn used to determine a new value of Dbqs which then generates another new value of X and so on. The iterative process will stop when the difference between the “old ,Y’ and the “new 2”’ is within the tolerance of 0.01%.

4 Dynamic two-phase locking model

In the model for the D2PL shown in Fig. I , one more service centre, the delay server (DLS), is added to model the delay for any aborted transactions for a pesiod of time before it is restarted so as to minimise deadlock-induced thrashing. Also the CPU has to perform undo operations for any aborted transactions to restore the original state of the database. These two types of workload overheads have often been neglected in other studies [2, 41. Here it is assumed that the lock requests of a transaction are evenly interspersed between its computations.

To estimate the effect of deadlocks, it is essential to compute the lock conflict probability. During the execution of a transaction the probability of lock conflicts encoun- tered by the transaction increases with the number of locks being held by it. The average probability of lock conflicts would approximately be when the transaction has acquired half of its locks. Thus, an assumption is made that when lock conflict probability is to be calculated each transac- tion on average is assumed to have acquired half of its granule locks at steady state. When a transaction requests a lock it is assumed to have already held HL locks, then PA which is the probability of a lock conflict is given by

(N - 1)”NL NG - HL

P6 =

where HL is half of the total number of locks accessed by a transaction. The expression implies that each lock conflict encountered by the transaction over its lifetime will have the same probability. A similar approximation was also used by Ryu [5] and Tay [2] in their analysis. When a deadlock occurs, the current requesting transaction among the deadlocked transactions in the wait-for graph is selected to be aborted and rolled hack, thereby releasing all its locks and so allowing some other transactions to proceed. In Pun’s analysis [4], deadlocks of cycle-length 2

IEE Proc.-Cumput. Digit. Tech., Vol. 146, No. 3, May I999

(involving only two transactions) were assumed. But we show later that this assumption may not be valid in the high data contention situations. Thus, a generalised expression is to be derived to cater for deadlocks of all possible cycle- length.

Let P,(m) he the probability of deadlock with cycle- length m (involving m transactions) when a transaction requests its granule lock. For a deadlock involving three transactions (m = 3) with TI 3 72 + 73 + TI, Pd(3) 1s then computed by the product of P(TI + 72 + 73) and the number of ways to choose 72 and 7’? among blocked transactions. As TI is equally likely to he blocked by any of the other transactions when a lock conflict occurs

P(T1 + T2llock conflict occurred) = I/(N - 1)

where 72 is any other transaction. P(T1 + n), the prob- ability of TI encountering a lock conflict and TI is blocked by T2 is

P(T1 + T2) = PiP(T1 + T2llock conflict occurred)

= P,”I/(N - 1) (1)

By the same argument

P(T2 + T3llock conflict occurred) = 1/(N - 1)

As 72 is a blocked transaction and is assumed to have acquired HL locks, the probability that it has acquired HL locks without lock conflicts

(1 - Pb)HL

So the probability that a lock conflict occurs after it has acquired HL locks

[ 1 - (1 - P6)HL]

P(T2 + T3) = [I - (1 - Pb)HL]=-

Similar to the derivation of eqn. 1,

(2) 1

N - l Since T3 is also a blocked transaction, and similar to the derivation of eqn. 2,

1 N - l

P(T3 --f T I ) = [l -(I -P*)HL]*-

As 12 --f T3 and T3 + 72 cannot happen at the same time, the number of ways to choose T2 and T3 is (N - l)*(N - 2), therefore

(N - 1)(N - 2) 1 - (1 - Pb)EIL

Pd(3) = (A)*( N - 1 N - 1

Generalising, the probability of deadlock with cycle-length m is

Thus, Pdead the probability that a transaction will encounter a deadlock of any cycle-length is

Fig. 2 shows a breakdown of deadlock probability. It shows that all deadlocks are almost of cycle-length 2 in the light data-contention situation. However, when data contention is becoming high, the occurrences of deadlocks of cycle- length greater than two are becoming significant and system thrashing begins to occur. Therefore deadlocks of

163

log(NG)

Fig. 2 Breakdown of deadlock analysis U length 2 -x- GT length 2 +all

cycle-length greater than two should also be taken into consideration in the high data-contention situations.

The amount of undo operations needed for an aborted transaction depends on how much processing has been done on it. The amount of this workload for undo opera- tions has often been neglected in other studies [2, 41.

Let Pr(n) be the probability that a transaction will restart after it has processed n data granules. Since a transaction may be restarted only after it has acquired at least one granule lock

Pr(0) = 0

pr( = Pdead

P@) = (1 - Pderrd)*Pdead

P r W = (1 - *pde0d

The amount of undo workload at the CPU for the aborted transaction after processing n data granules is

pr(n) * ( D , , / W * n

where D,,, is the total service demand of transactions at CPU. Therefore the mean undo workload W..,,. at the CPU for the average aborted transaction is

By the same argument, the mean undo workload W,, at disc units for the average aborted transaction is

where Dilo is the total service demand of transactions at disc units. These two mean undo workloads will be added to the input parameters of demand service at the CPU and disc units.

As the average transaction having acquired HL granule locks is assumed to hold, the mean delay of the aborted transaction should be at least half of the residence time of the average deadlocked transaction at CPU and disc units in the system

164

Let Pdr be the probability that an average transaction would encounter a deadlock in the system

NL-I

lI=l pdr = C p r ( 4

then the mean delay Dd,.v of the aborted transaction is

Dd/,T = pd/ '0.5 '(Repi.. + Rzlo)

where R,,, is the mean residence time of transactions at the CPU and Rjlo is the total mean residence time of transac- tions at the disc units. Again, Ddr, is expressed in term of transaction mean residence times at CPU and disc units in the system, an iteration technique is adopted to evaluate the model.

The estimation of the waiting time for a granule lock in D2PL is the most difficult part of modelling the database system, as stated in the many past studies [2, 4-61, The approach used in this paper is adapted from Tay's analysis of the waiting time in [Z]. Suppose now a transaction T5 requests a granule lock held by T3 as shown in Fig. 3. Its waiting time consists of three parts

(i) h l is the mean time for the root TI to terminate (ii) h21 is the mean time for 72 to terminate after it gets the locks h2* is the mean time for T3 to terminate after it gets the locks (iii) h3 is the mean time for T4 to terminate after it gets the locks

Every blocked transaction must wait for at least time h l . If d is the mean level of T? (d=2 in this example), T5 waits for the additional time d*h2 with a probability of P,, if the lock it needs is held by a blocked transaction. It also needs to wait for an additional h3 with a probability of Ppt if it joins a nonempty queue. Let Wbqs be the mean waiting time for a lock

Wbqs = hl + Pwt *d ' h2 + P,, "h3

We have assumed that the average transaction has acquired half of its requested granule locks. That means it has completed half of its processing. The mean time for the average transaction to terminate is equal to half of the residence time at CPU, disc units and the BQS. Then

hl = h2 = h3 = 0.5 *(Rcpc, + Ri/, + where Rhys is the mean residence time of transactions at BQS. The probability that the blocked transaction is blocked by another blocked transaction

1 - (1 - Pb)HL *(1/N ~ 1))

Therefore

P,",= l - ( l -P$L*( l / (N- l ) )

level 2 d-? T3

IeYe13 T5

Fig. 3 Decomposition of wnilig rime into rhreeports

IEE Proc.-Comput. Digit. Tech.. V O l 146, No. 3, Mqv I999

Also N - 2

d = I *(P,",)' i= I

As to the estimation of Pp,, one can see in the example, the probability that T4 would request the same granule lock which is also needed by T5 is one of the available granule being not locked. Then Pp,= 1 / (NG ~ HL* N). Therefore

Db, = Pb ' N L * Wbqs

= Pb*NL*0.5*(1 +P,,"d+Ppt)'(Rcpu+Rilo+RbUs)

where Pb is the probability of lock conflict by the transac- tion, Thus, the analysis of the block queue delay here is only based on the same assumption as made on the lock conflict probability.

5 Analysis of results

Fig. 4 and 5 show the system throughput against normal- ised transaction size with the base transaction size of 30 data items for different MPLs for both locking protocols. It is observed that as TS is increased, the system throughput degrades more at high MPL than at lower MPLs in both protocols because of the higher data contention at high

0 1 , O 1.7 2.3 3.0 3.7 4.3 5.0 5.7

normalised transaction Size

Fig. 4 SZPL dz@emnt MPL on TS NG=800 &MPL=Z -x- MPL = 4 + M P L = 8

600 ~ - d 400

a

e 5 200

100

0 1.0 1.7 2.3 3.0 3.7 4.3 5.0 5.7

normalised transaction size

Fig. 5 D2PL drffermt MPL on TS NC = 800 +MPL=Z -x- MPL = 4 U M P L = 8

IEE Proc.-Cosipul. Di@ Tech.. Yo/. 146, No. 3, May 1999

MPL. In D2PL, the system throughput of high MPL falls below that of low MPL. As transaction size is increased, more locks have to be acquired. The number of lock conflicts encountered by a transaction will increase, result- ing in longer waiting time at the block queue. This in tums implies a greater chance of deadlocks at higher MPLs with accompanying restart and rollback operations. In compar- ison, large transactions are more adversely affected by finer granularity in DZPL than in S2PL. Therefore for large transactions SZPL performs much better than D2PL under a high data contention environment.

Figs. 6 and 7 show the system throughput as a function of database granularity. System throughput increases initi- ally for both protocols but decreases under very fine granularity. The optimum granularity for maximum throughput exists at the point DS/TS as postulated by Pun [4] (OS is the total number of data items in the database). For MPL = 2, D2PL performs slightly better than S2PL. It is because the average locking time under fine granularity is shorter for DZPL than S2PL. However, for MPL = 4 and MPL = 8, S2PL significantly outperforms D2PL under fine granularity. Increased blocking in DZPL causes deadlock induced thrashing to occur [SI.

For S2PL in Fig. 8, as MPL is increased, the system throughput increases in diminishing amount and will be bounded for larger values of MPL. It can be explained that

20 :"1 0 0.0 0.4 0.8 1.2 1.6 2.0 2.4 2.8 3.2 3.6

W N G )

Fig. 6 S2PL granulari@ TS= 100 &MPL=Z -x- MPL = 4 + M P L = 8

2 w

180

160

- 140 6 0 p 120

2 1w

2

1

r m 80

c - E n 40

20

0 0.0 0.4 0.8 1.2 1.6 2.0 2.4 2.8 3.2 3.6

W N G )

Fig. 7 DZPL granulmiry TS= io0 &MPL=Z -x- MPL = 4 + M P L = 8

165

5 60

-f I I I : I I ! ~ 1 0 0 2 4 6 8 10 12 14 16 18 20

MPL Fig. 8 SZPL efkr ofMPL TS= I00 &NG=IOO -x- NG = 200 U N G = 4 0 0 -+- NG = 800 - NG = 1600

Fig. 9 TS= 100 &NG=100 -x- NG = 200 +NG=400 -+- NG = 800 - NG= 1600

DZPL efect of MPL

::I ~ : I ~ ; I 1 0 0.0 0.4 0.8 1.2 1.6 2.0 2.4 2.8 3.2 3.6

loQ(NG)

Fig. 10 SZPL g,anu/avify TS=100, MPL=2 -x- analytic ~ simulation

I66

::I I I ~ ~ ! ~ 1 0 0.0 0.4 0.8 1.2 1.6 2.0 2.4 2.8 3.2 3.6

lOQ(NG) Fig. 11 SZPL gronu/mify TS= 100, MPL = 4 -x- analytic ~ Sirnulafim

~ : ~ : ! I ! I ! I ~, 0 0.0 0.4 0.8 1.2 1.6 2.0 2.4 2.6 3.2 3.6

IOQ(NG)

Fig. 12 SZPL granuianry

-x- analytic TS=l00, MPL=8

- simulation

once the granule locks are saturated, increasing MPL has no effect on the system throughput. For D2PL in Fig. 9, for large MPL, the system throughput either stays almost constant for fine granularity or decreases beyond a certain MPL for coarse granularity. For coarse granularity, system throughput decreases significantly because of deadlock induced thrashing [8]. For a given granularity in D2PL. an optimum MPL exists for maximum system throughput.

160

::I I ; I ~ ~ : : 1 0 0.0 0.4 0.8 1.2 1.6 2.0 2.4 2.8 3.2 3.6

log(NG)

Fig. 13 DZPL gronuiwiry TS= 100, MPL =2 -x- analytic - simulation

IEE Proc.-Compur Digif. Tech., Vol. 146. No. 3, May IYYY

Fig. 14 DZPL ~mnular iq TS=lOO, MPL=4 -x- analytic - simulation

4--+.++\1 0 0.0 0.4 0.8 1.2 1.6 2.0 2.4 2.8 3.2 3.6

l o g ( W Fig. 15 DZPL ~ m m / w i @ TS=IOO,MPL=8 -x- analytic - simulation

The accuracies of the analytic results for the two models are validated with simulation results. Figs. 10, 11 and 12 are the set of analytic and simulation results showing the effect of changes in database granularity on the system throughput for SZPL with MPL = 2, 4 and 8 respectively. Figs. 13, 14 and 15 are the set of analytic and simulation results for D2PL. There is good agreement between the analytic and simulation results except for NG = 1 and for large NG values.

6 Conclusions

We have proposed two analytic models for performance evaluation of locking protocols in database systems. We

have studied two impoaant locking protocols namely the static and dynamic two-phase locking. We used the simple combinatorial and probabilistic arguments to devise an efficient way of estimating blocking delays for the two locking protocols. Unlike other studies which neglect the impact of deadlocks or assume deadlock to be of cycle- length 2, we have considered the deadlocks of cycle- lengths greater than 2, which we have shown can cause system thrashing in the high data contention situation. The analytic models are easy to understand and the analysis is straight fonvard. The analytic results on the whole agree well with simulation results.

. Large transactions are more vulnerable to fine granular- ity and high MPLs in DZPL than in S2PL.

For both locking protocols, the optimum granularity for maximum throughput depends on transaction sizes in a manner as postulated by Pun [4].

D2PL works better than S2PL in the light data conten- tion situation whereas S2PL works better in the high data contention situation.

An increase in MPL always improves system perfor- mance in S2PL whereas an increase in MPL in D2PL beyond a certain level results in a degradation in system performance and thrashing. Therefore a control policy to restrict the number of MPL should he utilised in D2PL.

In DZPL, system performance is affected more by transaction blocking due to lock conflicts than by transac- tion restarts due to deadlocks.

The conclusions to be drawn from the results are

7 References

I BERNSTEIN, P.A., Y HOLZIBACOS and N.FOODMAN. 'Concur- rency control and recovery in database systems' (Addison-Wesley, 1987)

2 TAY, Y.C., 'Locking performance in centralized database' (Academic Press, 1987)

3 THOMASIAN A., 'A performance comparjson of locking methods with limited wait depth', IEEE Tram Knowl. Data Eng., 1997, 9, (3) pp. 421434 PUN, K.H. and BELFORD F.G. 'Performance study of two phase lockine in sinele-site database systems'. IEEE Trans., 1998. SE-13, 12,

4

pp. l3y1-1328 5 RYU I.K., and THOMASIAN, A. 'Analysis of database performance

with dynamic locking', J ACM, 1990, SE-37, (3), pp. 491-523 6 HARTZMAN, C.S., 'The delay due to dynamic two-phase locking',

I€€E Trons. 1989, SE-15 (I), pp. 72-82 7 MITRA, D. and WEINBERGER, PJ. 'Probabilistic models of darabase

locking, solutions, computational algorithm and asymptotics', J ACM, 1984,31, (4), pp. 855-878

8 THOMASIAN, A., 'Two-phase locking performance and its thrashing behavior', ACM Trans. Datobase Sy$t, 1993, 18, (4) pp. 579-625

9 YU, E., and DANIEL M. DIAS., 'Performance analysis ofconcurrency control using locking with deferred blocking', IEEE Tranr., 1993, SE- 19, (IO) pp. 982-996

10 F E W , D., 'Computer systems performance evaluation' (Prentice- Hall, Englewaad Cliffs, NJ, 1978)

IEE Proc.-CompuL Digil. Tech., Yo/. 146, No. 3, May I999 167


Recommended