Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 14 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
14
Dung lượng
1,76 MB
Nội dung
V N U JO U R N A L OF S C IE N C E Nat ■ Sci & Tech ĩ XIX, N.j4 2QQ3 _ EVALUATIƠN OF CPM - A COMMIT PROTOCOL FOK M O B IL E D IS T R IB Ư T E D DATABASE SY S TEM S Le H u u L a p pnsts T e lecom m un ica tions In s titu te ()f Technology N g u v e n K h a c L ic h , T r a n T h e T r u y e n Research In s tĩtu tv f th e m ost vvrdelv used 2PC and to a llo w u se r-e n a h le d d isco n n e ctio n s and o fflin e Processing S ection provides a sh o rt re v ie w o f s e v rra l c o m m it protocols and p o in ts out d w b a c k s o f 2PC in m o bile c o m p u tin g S ection describes and analyzes th o th e o re tỉc a l aspects o f th e C F M T h e n e x t tw o sections p re se n t th e m o d e lin g and s im u la tio n o f th e C P M Figure 2: Logical view o f DDBS Kigure 1: Generic physical model o f MDDBS C o m m o p itm en t in d is trib u te d transaction Processing 2.1 T r a n s a c tio n M o d e ls T h e re have been m a ny tra n s a c tio n m odels proposed fo r m o b ile c o m p u tin g [2, 3, 12] th a t c a p tu re cla ssica l tra n s a c tio n m anagem ent íe a tu re s such as co n currency c o n tro l an d re co ve ry |1Ị and m o b ility For the purpose o f th is p a per, th e y are assum ed to a lre a d y e x is t A d is tr ib u te d tra n s a c tio n T in itia te d a t a s ite sists o f n u m b e r o f íra g m e n ts {T tJ} w h ic h a re d is trib u te d to p a r tic ip a tin g s ite s to execute The g e n e ric tra n s a c tio n m odel considered a p p lic a tio n s (A P P k/ fo r a r b itr a r v k e in th is p a p e r c o n s is ts o f a set o f J} o rig in a tin g tr a n s a c tio n T, a t M U s A T, re q u ire s th e in v o lv e m e n t o f a set o f p a rtic ip a n ts Ị ỉ >,/j € J, J = a n d a set o f c o rre s p o n d in g tra n s a c tio n c o n tro lle r ÍTC JỊ Each tra n s a c tio n c o n tro lle r T C J handles c om m an ds re la te d to tra n s a c tio n on b e h a lí o f p a rtic ip a n t p ’ O ne o f th e TC' is chosen to be th e c o o rd in a to r (CO) fo r c o o rd in a tin g th e tra n s a c tio n in M a s te r/ Slave ía s h io n T h e re art* no rc q u ire m e n ts on th e lo ca tio n o f T O in th e netvvork and w itli respect to b u t th e c o o rd in a to r s h o u ỉd ho located in re lia b le w ire d n e tw o rk to e n su re s a tis fa c to rv p e rform an ce 2.2* C om m it p ro to co ls It is a s tric t re q u ire m e n t o f a to m ic ity in database tra n s a c tio n s , th a t a tra n s a c tio n T m ust e ith e r fu lly c o m m itte d o r abortecl at a ll p a r tic ip a tin g sites To e n su re th is p ro p e rty a c o m m it p ro to c o l is exeeuted hy the tra n s a c tio n c o o rd in a to r, E ỉ u Ị iK ítio n ()f ( 'PM a c o m rn it p r o to e o l fo r ;ifte r a ll > itfs in lu rm i h r i r c n m p lc tio n o fT , A m o n g th e niost W1 (||*I\ rlcplo yed IS thi* Ttvo-Phơsc C o n m iit r J lV ) p ro tn m l w h ií h \ve w ill d e s c rib r in m ore cit»f;ii in thí* next su h srcĩion Kvrn thuimlì 2IH* IS ro n sid e rc d to be i n s u íĩic ir n t b c r a u s e C)f high c o m m it ro st «1 1 ( p o ír u t lỉil (>f 1/0 h ỉo c k in g T h e re have becn m a n y a tte m p ts to irn p ro v r th e IH ' and to proposi* a ltc rn a tiv e s to solve these issm \s Som c a im at m in im i/m t' n is ts oỉ ||>H w r itin g and C om m unications, in w h ir h P rC (P re sum e d C o m m it) and K a r lv P rcp a rc |w ]| an* o f thoso noticeable O th e r re search in c lu đ e s 1IH and v a ria n ts such iis ( 'L P (C o o rđ in a to r Log P rotocol), and ỈY V P ( Im p lic it YesVoti* P rotocol) 1PC Itf!iurt\s th e P R E P A R K phase o f ‘2 PC b u t its a s s u m p tio n s are too s tr ic t to be tis H u l in ro m m e rria l svstem s ỉn c o n tra s t to those ap pro ache s, 3P C (th re e -p h a se c o m n n t) in tro đ u c e s m ore cost and c o m p le x ity bv an a d d itio n a l phase to h c lp avoul th e I/O h lo c k in ^ in 2PC 2.3 T ĩvo p h a s e c o m m i t p r o to c o l Thi* ro m m it p ro to rn l as 1> nam o in d ic a ỉc s , has tw o phases: th í' f ir s t asks fo r v o tin g fro m a ll s ite s roíKỈy to c o m m it and the second c a rry out th e c o m m itm e n t P h a s e 1: c o íu lils record « P K K I \ \ R K T , » to the log, w r itc s th e lug to s ta b le storage and s ta rts a tim e r (F K K P A R E _ T IM E O U T ) th e n sends P R E P A R E message to a l! T C O n re e e iv in g such a message, each T decides vvhether o r n o t to c o m m it l f the nnsvver is N O T O ;ul(ls record « N T „ » to th e log and responses A B O R T T to CO O th e rw is e T í ' 1adds record « R E A D Y T „ » to the log a n d forces th e log to the sta h le storage T C ' re p lic s K E A D Y T „ to c o P h a s e U pon re c e iv in g R E A D Y T,, fro m a ll TC ' w ith in tim e o u t p e rio d , c o l*orce-\vrites T, log to s ta b lc stnrage A t th is p o in t, th e fat(» o f th e tra n s a c tio n is ilu te rm in c d c o th e n simh I s C O M M IT T, to a ll T C In th e bad ca se, th e P R E P A R E phase tim e o u ts , c o logs T, and sends A B O R T T, to a ll T O VVhen T C ' receives a C O M M IT or A B O R T fro m c o , it vvrites the message to th e lơg, th e n ackn ow led ges back to CO D espite th e p o te n tia l o f b lo c k in g , the tvvo-phase c o m m it p ro to c o l is c u r r e n tlv thi* m ost vvidely ust‘d in p c tire fo r (lis trib u te đ databasc System s |1 0| Hovvever, it m ay be (liH ic u lt to a p p ly in m o b ile d is trib u te d e n v iro n m e n t For e x a m p le , the m obile users m ay te m p o rn rily clisconncct to process its tra n s a c tio n fra tfm e n t o fflin e fo r sa vin g povver, and th is actio n can lead to tra n s a c tio n a b o rt, r e s u ltin g in th e h ig h abort fre que ncy T h is is because o f a c ritic a l p o in t in 2PC, th a t a fte r tra n s a c tio n executions fin is h , t h i‘ (lecision to c o m m it re lie s e n tire ly on th e chosen c o o rd in a to r, w h ich may not hv iiNvarc oí’ m obile User preỉerence Once th e (.’ () decides to c o m m it the connectio ns need to biĩ kept to avoid possible a b o rt due to tim e o u t* T h is can be done rt*lia b ly in h ig h c Ịiia lity w ire d n e tw o rk , b u t th e re are no g u a n te e s in the vvireless Le H u u L a p y N guyên K h a c L i c h y T r a n The T ru ye n In a d d itio n , 2PC m ay n o t be s u ita b le fo r M U s w ith s m a ll m e m o ry because the y have to m a in ta in a locai log to ndle CO*s dem ands a t a n y tim e A n o th e r weakness o f 2PC is due to its c o m m it n a tu re o f phases r e q u ir in g 4p messages (vvhere p is n u m b e r o f p a rtic ip a n ts ), vvhich are th e r exp e n sive in m o bile Communications in te rm (>f tim e (and possibly m oney since th e m o b ile cost is u s u a lly d e te rm in e d on th e basis o f connection tim e ) CPM • Comniit p roto col for m obile tra n sa ctio n m o d els 3.1 T h e C P M C o m m ỉt P ro to c o l In th e lig h t o f above discu ssio n, it is reasonable to m in im iz e th e need to co m m u n ica te over w ire le s s lin k and the n u m b e r o f messages p a s s in g in th e netvvork per tra n s a c tio n We proposed a novel com m it protocol c a lle d C P M (C o m m it p rotocol fo r A /obile T n s a c tio n s ) th a t avoids th e possible d isc o n n e c tio n s d u rin g th e co m m it process In a d d itio n CPM enables u se r-p ro a ctive đ is c o n n e c tio n an d o fflin e Processing fo r a r b itr a r y a m o u n t u f tim e The d isco n n e ctio n m ay be in itia te d by M U ’s tra n s a c tio n c o n tro lle r before decision to c o m m it is made O u r c o m m it p rotoco l C P M operates u n d e r ge neric m odel p re s e n te d in S ection 2.1 A lth o u g h each T C J (loes n o t need to be a t the same s ite as c o rre s p o n d in g P \ T C k is set a t M U site to a vo id possible c o m p le x ity in local c o m m u n ic a tio n v ia vvireless m e dium In C PM , th e tra n s a c tio n c o n tro lle r o f M U (T C k) w h e re a tra n s a c tio n T, is o rig in a te d plays th e ro le o f c o o rd in a to r in 2PC d u rin g tra n s a c tio n e xe cu tio n Ít d ivid e s th e tra n s a c tio n T, in to a g m e n t set \v rite s th e tra n s a c tio n e x tra c ts its íra g m e n t T lk and force- log to sta b le storage In s te a d o f s e n d in g th e re st o f tra n s a c tio n T ầị - T ,k to c o o rd in a to r as in 2PC, T C k d is tr ib u te s those fra g m e n ts to co rre sp o n d in g p a rtic ip a n ts and s ta rts a T R A N S _ E X E C tim e o u t Each p a rtic ip a tin g site executes its p a rt a n d send co m p le tio n message back to th e re q u e s te r I f th e T C k receives a ll such messages, it s ta rts th e c o m m it process by sen ding C O M M IT _R E Q U E S T message and tra n s a c tio n log to c o U po n re c e iv in g c o m m it re que st and tra n s a c tio n log fro m T C k, c o fo re -w rite s th e log to s ta b le storage and sends C O M M IT message to a ll p a rtic ip a tin g sites Each s ite th e n c o m m its its tra n s a c tio n p o rtio n T M and acks back to co acknow led gem e nts are received a t c o , th e c o ònce fin is h e d If a ll such logs th e tra n s a c tio n and sends C O M M IT _ A C K message back to T C k T h e tra n s a c tio n is c o m p le te d fro m now on and CO can íb rg e t about it N o te th a t th e re is no need to send C O M M IT to T C k because th e C O M M IT A C K is a lw a y s em bedded in C O M M IT R E Q U E S T b e fore nd T h u s the n u m b e r o f messages p a ssin g vvireless m e dium is m in im iz e d O th e rw is e th e TR AN S_EXEC tim e o u t is trig g e re d be fo re T C k gets a ll T R A N S A C K fro m p j, T C k sends A B O R T message to c o and T R A N S _ N O T _ O K to A P P k In th is case, c o has n o t logged the tra n s a c tio n y e t so th e A B O R T message E v a ỉ u a t i o n ()f C 'ỉ * \ i a v o m m it p r o to c o l fo r m>i‘ds to c a rry a ll n o crssa rv in fo rm ;itio n ab o u t th e ab o rte d tra n s a e tio n (i.e ID o f p a r tin p iin ts U s in ^ g iv rn in fo rm a tio n , c o m u ltic a s ts A B O R T messages to a ll TC ' {J * h) T ( ’ t h r iì t r lls its co rre s p o n d in g p tơ a b o rt As m e iìtio n e d abọvo, tho p a rtic ip a n t P' and the a g ent T a c tin g on its b e h a lf a r r not n e ce ssa rily at t h i’ sanu' s it t \ so d u rin g the c o m m it process, p* m ay fa il and m ay Iio t v e n tv th e c-ommit w ith T O So T C J needs to use a C ()M M !T _ K X E C tim c o u t vvhriì c o m m a n d in g r Upon re c e iv in g such com m and, p rin is h e s its tra n s a c tio n p o rtio n a n d th e n lo tf-w rite s a “ c o m m it” The tra n s a c tio n p o rtio n is done I f the lim e o u t is passed and P' has not c o n firm e d th e c o m m it, T C assum es th e ĩa ilu re o f l >! T C th e n checks the existonce o f “ c o m m it'’ log a t P \ I f th e log cỉoes no t e x is t, the T C ’ tu ll p to rtj d() th i' tra n s a rtio n e xe cution and c o m m it prơcedures Once re c e iv in g C ()M M IT _ A C K fro m c o T C k sends T R A N S O K to A P P k the vvhole tra n s a c tio n is ỉu lly com pleted The C PM can be expressed s e m i-fo rm a lly in te rm o f pseudo code as in P igure -F ig u re A c ỉ i v i l i c s uỉ A P P : b e g in send tra n s a c tio n w a it u rvtil i f ( t he e ls e T • t- TC k • re c é iv in g r- in s tru c tio n rr or ĩ ì TC i n s t r u c t i o n i s TRANS OK) s t a r t new t r a n s a c t i o n a f t e r //th e t r a n s a c t io n restart a tim e in te rv a l 25 a b o rte d t.ra n s a c tio n afte r a tim e in te rv a l end F ig u re 3: CPM a lg o rith m at a p p lỉca tio n APP /\( / vilics cit T C : B e g in k if(T C re c e iv e b e g in k TC send a tra n s a c tio n T to TC" w r it e t:he a 11 TCk è x t r a c t s c h ed u ler «LOG its //th is T ;) T, » to and p la y s then th e ro le of g e t írag m en ts RAM p o rtio n T lk ị T T lk} Ỳ T C ' send the TC process TC st.art rest its tim e r i f ( t im eout - p o rtio n not a ll co rre s p o n d in g fo r c o n firm a tio n re c e iv e a ll send ABORT T TCk senđ TRANS to co NCT_OK T , co A P P k end e ls e TC ro -e iv e 311 TRANS ACK: from { p ' } T RANS_ACK b e g in TCk p} T lk and w a i t &Ẳ TC to of T ) TC k {Tt l| Le H u u L a p , N g u y ê n K h a c L ic h , T r a n The T ru y e n 40 b eg in T C k s e n d COMMI T T ; , a l l < > to stabỉe storage send COMMIT T to a 11 TC' w a i t f o r a c k s f r o n TC if(CO re c e iv e a ii c o m p iete send the C CM MI T _ AC K T c n s a c tio n COMMI T ACK T, to from T, TC ) and T C' end end F ig u re 6: CPM a lg o rith m at co o rd in a to r c o 3.2 C ost a n a ly s ỉs