Distributed Databases Yingying

download Distributed Databases Yingying

of 25

description

distributed database

Transcript of Distributed Databases Yingying

  • Distributed Databases and Its Twelve ObjectivesCS157BName: Yingying WuProfessor: Sin-Min LeeReference Book: An introduction to Database SystemsBy C.J.Date

  • Definition of Distributed Database:A distributed database system consists of a collection of sites, connected together via some kind of communication network, in which: a. Each site is a full database system site in its own right. b. The sites have agreed to work together so that a user at any site can access data anywhere in the network exactly as if the data were all stored at the users own site.

  • CommunicationnetworkNew YorkShanghaiLondonSan FranciscoA typical distributed database system:

  • The Fundamental Principle of Distributed Database To the user, a distributed system should look exactly like a nondistributed system.

  • What is the 12 objectives?Local autonomyNo reliance on a central siteContinuous operationLocation independenceFragmentation independenceReplication independenceDistributed query processingDistributed transaction managementHardware independenceOperating system independenceNetwork independenceDBMS independence

  • Why study the 12 objectives? --Useful asA basis for understanding distributed technology in generalA framework for characterizing the functionality of specific distributed systems.

  • Objective 1Local AutonomyAll operations at a given site are controlled by that site.No site X should depend on some other site Y for its successful operation. -- Otherwise site Y is down might mean that site X is unable to run even if there is nothing wrong with site X itself.

  • Objective 2No Reliance on a Central SiteAll sites must be treated as equals.There must not be any reliance on a central master site for some central servicefor example, centralized transaction management.Two reasons:The central site might be a bottleneck.If the central site went down, the whole system would be down.

  • Objective 3Continuous OperationProvide greater reliability and greater availability it is the advantage of distributed systems in general.Unplanned shutdowns are undesirable, but hard to prevent entirely.Planned shutdowns should never be required.

  • Objective 4Location IndependenceAlso known as location transparency.Users should not have to know where data is physically stored, but rather should be able to behave -- as if the data were all stored at their own local site.

  • Objective 5Fragmentation IndependenceA system supports data fragmentation if a given base relation can be divided into pieces or fragments for physical storage purposes. Two benefits: 1. most operations are local 2. reduce network traffic

  • An example of fragmentationDefine two fragments: FRAGMENT EMP AS N_EMP AT SITE New York WHERE DEPT# = DEPT#(D1) OR DEPT# = DEPT#(D3) S_EMP AT SITE Shanghai WHERE DEPT# = DEPT#(D2)User perception

    EMPNew York

    N_EMPShanghai

    S_EMP

  • Objective 6Replication IndependenceA system supports data replication if a given base relation or fragment can be represented in storage by many distinct copies or replicas, stored at many distinct sites.Ideally should be transparent to the user.

    Desirable for two reasons: 1. Applications can operate on local copies instead of remote sites. 2. At least one copy available

  • An example of replicationREPLICATE N_EMP AS SN_EMP AT SITE Shanghai; REPLICATE S_EMP AS NS_EMP AT SITE New York;New YorkN_EMPShanghaiNS_EMP

    (S_EMP Replica)S_EMPSN_EMP

    (N_EMPReplica)

  • Objective 7Distributed Query ProcessingA relational distributed system is likely to outperform a nonrelational one by orders of magnitude.The query that involves several sites, there will be many possible ways of moving data around the system.

  • Example:Consider Query Get supplier numbers for London suppliers of red partsDatabase (suppliers-and-parts, simplified):S {S#, CITY} 10,000 stored tuples at site AP {P#, COLOR} 100,000 stored tuples at site BSP {S#, P#} 1,000,000 stored tuples at site AAssume every stored tuple is 25 bytes(200 bits)long.Query (Get supplier numbers for London suppliers of red parts):( ( S JOIN SP JOIN P )WHERE CITY = London AND COLOR = COLOR (Red) ) { S# }Estimated cardinalities of certain intermediate results:Number of red parts = 10Number of shipments by London suppliers = 100,000Communication assumptions:Data rate = 50,000 bits per secondAccess delay = 0.1 second

  • We now briefly examine three possible strategies for processing this query, and for each strategy calculate the total communication time T from the formula:( total access delay ) + (total data volume / data rate)Move parts to site A and process the query at A. T1 = 0.1 + (100000 * 200 ) / 50000 = 400 seconds approx. (6.67minutes)2. Move suppliers and shipments to site B and process the query at B. T2 = 0.2 + ( ( 10000 + 1000000 ) * 200 ) / 50000 = 4040 seconds approx. (1.12 hours)3. Restrict parts at site B to those that are red and move the result to site A. Complete the processing at site A. T3 = 0.1 + (10 * 200 ) / 50000 = 0.1 second approx.

  • Objective 8Distributed Transaction ManagementRecovery The system must ensure that the set of agents for that transaction either all commit in unison or all roll back in unison. Achieved by two-phase commit protocol.Concurrency Typically based on locking.

  • t1t4t5t6t2t3t7t8t9GETREADYOKDOITDONEITCoordinatorParticipantTwo-phase commit:Force decisionLog entry-end ph.1,start ph.2In doubtForces a log entry for agent

  • Objective 9Hardware IndependenceReal world involves a multiplicity of different machinesIBM machines, HP machines, PCs and workstations of various kinds.Need to be able to integrate the data on all of those systems.Desirable to be able to run the same DBMS on different hardware platform.

  • Objective 10Operating System IndependenceBe able to run the same DBMS on different operating system platforms.Have (e.g.) an OS/390 version and a UNIX version and a Windows version all participate in the same distributed system.

  • Objective 11Network IndepenceDesirable to be able to support a variety of disparate communication networks also.

  • Objective 12DBMS IndependenceAll needed is that the DBMS instances at different sites all support the same interface they dont necessarily all of the same DBMS software. For example, if Ingres and Oracle both supported the official SQL standard, the Ingres site and the Oracle site might be able to talk to each other in a distributed database system.

  • GATEWAYIngres(SQL)Oracle(SQL)IngresdatabaseOracledatabaseIngres userDistributed Ingres databaseA hypothetical Ingresprovided gateway to Oracle:Site XSite Y

  • Thank you!