CS514: Inemediae Coue in Oeaing Syem Pofeo Ken Biman Vivek Vihnumuhy: TA Relicaion A fundamenal conce wih many ue If we can olve hi coe oblem, we can aly he oluion in many eing Relicaion i a baic imiive Bu one miing in mo develomen oolki We find elicaion mechanim inide he oeaing yem (e.g. IBM WebShee ue elicaion, a doe Micoof Window Clueing echnology ) End-ue ofen given weake oluion (ub-ub) Ue of elicaion Relicae daa o a evice fo high availabiliy Relicae daa o ha gou membe can hae load and imove calabiliy Relicae locking o ynchonizaion ae Relicae membehi infomaion in a daa cene o ha we can oue eue Relicae managemen infomaion o aamee o une efomance Who doe he elicaion? We hink of elicaion a haening inide gou Could be a gou of idenical comonen O ju a gou of ocee ha aked o join in ode o elicae a daa ucue Membe migh be diffeen ogam... Someime we know who migh be a elica ahead of ime ( aic model ), omeime no ( dynamic model ) Two elicaion model Iue aied? Saic membehi Dynamic membehi Saic model Ofen only a ube of he elica ae unning Need o agee on ode of concuen udae Mu deal wih inconiency in elica ha wee down fo a while bu now have ecoveed Dynamic model Membehi change a membe join/fail/leave Reo view change How o deec failue? How o iniialize elica (joining membe)? Need o agee on ode of concuen udae Nomally, failed membe elaced by ohe ocee 1
Fuhe iue aied Doe choice of model Imac efomance? Imac lafom comlexiy? Imac yem-wide deign hiloohy, e.g. degee of ue of end-o-end idea? Le focu on udae odeing We wan o Relicae daa Udae i while acceing i Wha o of iue mu be addeed? Dill down: Life of a gou If ie o eliably mulica o, i won ge an ack and will wai indefiniely. Q doe an udae. Bu how I need can o be ue ha ha failed? If each he hee i membe wong, will be miing an udae! Iniial gou membehi Now i {,, goe } u offline fo a while. Maybe i cahed 0 u 1 Hee, Hee wo we dae ee he occu udae concuenly: odeing iue ee again u 0 followed by in a u ue 1, bu fom. ee u Which 1 fi, hen came u fi, 0. Poce i ill offline; udae i ee Now neihe. o i back one Thi fom online illuae? and wo iue: udae eumably ode and gou hould membehi eceive he udae i ending. Queion o ak abou ode Who hould eceive an udae? Wha udae odeing o ue? How exenive i he odeing oey? Queion o ak abou ode Delivey ode fo concuen udae Iue i moe uble han i look! We can fix a yem-wide ode, bu Someime nobody noice ou of ode delivey Syem-wide odeing i exenive If we cae abou eed we may need o look cloely a co of odeing Odeing examle Syem elicae vaiable x, y Poce end x = x/2 Poce end x = 83 Poce end y = 17 Poce end z = x/y To wha degee i odeing needed? 2
Odeing examle x=x/2 x=83 Thee clealy conflic If we execue x=x/2 fi, hen x=83, x will have value 83. In ooie ode, x i lef eual o 41.5 Odeing examle x=x/2 y=17 Thee don eem o conflic Afe he fac, nobody can ell wha ode hey wee efomed in Odeing examle z=x/y Thi conflic wih udae o x, udae o y and wih ohe udae o z Commuaiviy We ay ha oeaion commue if he final effec on ome yem i he ame even if he ode of hoe oeaion i waed In geneal, a yem woied abou odeing concuen even need no woy if he even commue Single udae In many yem, hee i only one oce ha can udae a given ye of daa Fo examle, he vaiable migh be eno value fo a emeaue eno Only he oce monioing he eno doe udae, alhough eha many ocee wan o ead he daa and we elicae i o exloi aallelim Hee he only odeing ha mae i he FIFO odeing of he udae emied by ha oce Single udae If i he only udae ouce, he need i a bi like he TCP fifo odeing 3
Muual excluion Anohe imoan cae we ll udy cloely Aie in yem ha ue lock o conol acce o haed daa Thi i vey common, fo examle in anacional yem (we ll dicu hem nex week) Vey ofen wihou lock, a yem aidly become coued Muual excluion Suoe ha befoe efoming conflicing oeaion, ocee mu lock he vaiable Thi mean ha hee will neve be any ue concuency And i imlifie ou odeing euiemen Muual excluion Dak blue when holding he lock How i hi cae imila o FIFO wih one ende? How doe i diffe? Muual excluion Ae hee udae in FIFO ode? No, he ende in alway he ame Bu ye in he ene ha hee i a uniue ah hough he yem (coeonding o he lock) and he udae ae odeed along ha ah Hee udae ae odeed by Lamo haened befoe elaion: Tye of odeing we ve een Tye of odeing we ve een cheae Sill chea Moe coly Mo coly Delive udae in an ode maching he FIFO ode in which hey wee en Delive udae in an ode maching he ode in which hey wee en Fo conflicing concuen udae, ick an ode and ue ha ode a all elica Delive an udae o all membe of a gou accoding o membehi view deemined by odeing udae w view change fbca cbca abca gbca Delive udae in an ode maching he FIFO ode in which hey wee en Delive udae in an ode maching he ode in which hey wee en Fo conflicing concuen udae, ick an ode and ue ha ode a all elica Delive an udae o all membe of a gou accoding o membehi view deemined by odeing udae w view change 4
Now coninue o dill down We dilled down on odeing Bu wha abou failue? Wha make i had? Deecing a failue i vey icky Newok can loe meage a machine can be biefly diconneced fom he newok o could exeience a bief oveload cauing i o un low, o ignoe incoming meage, o feeze u Ae hee anien oblem failue? Tanien veu eal failue A eal failue ei long enough o ha he yem ha no choice exce o move on I may ake ove ome ole fom failed oce (a backu could become imay) Alhough he imay migh ecove, i won be he imay eve anymoe! A anien failue eai ielf befoe ievocable comenaing even occu Ae hee any eal failue? Thi lead o a view ha failue in abolue In fac we can diinguih a failed machine fom one ha i imly no eonding And hi i fundamenal Ae hee oion ohe han ue failue deecion? Oion fo coing wih faul One idea i o build a yem o ha if a majoiy of ocee i unning, he yem can coninue o un Thi lead o uoum oluion Saic gou of 3 could have a uoum ize of 2 Oion fo coing wih faul Anohe aoach le he gou manage i membehi dynamically We do need a uoum voe when membehi change bu no fo ead and wie oeaion Membehi change: fail Membehi change: join 5
Oion fo coing wih faul We alo need o deal wih ocee ha join (o ecove and ejoin) a gou Thi involve no ju a membehi change bu alo a ae anfe Ued o iniialize elicaed vaiable When join, i won know he cuen value of he elicaed vaiable. Sae anfe ued o iniialize i: a fom of checkoin/ea Tye of odeing we ve een Ode of an udae elaive o a membehi change When oce cahed, no longe needed o wai fo i o acknowledge udae When ecove, mu again end i udae. And i need o fix any daa ha wa udaed while i wa down Peek ahead in CS514 We ll build oluion o hee oblem One way: uoum oocol + 2PC Gou membe ae a ube of ome li Read and udae uoum mu ovela. Fo examle, ead oeaion vii 2 membe; udae vii N-1 membe 2PC needed a a of he udae oocol Second way: ue uoum mehod only o manage gou view membehi Enable high-eed mulica oocol and cheae ead Recommended eading In he exbook, we e a he beginning of Pa III (Chae 14) Bu anacional model i coveed in Chae 6 and 22 Fo nex week will focu on ha maeial 6