Presentation is loading. Please wait.

Presentation is loading. Please wait.

Distributed Databases Reference Books: An introduction to Database Systems - By C.J. Database Systems and Concepts – Silberchatz, Korth and Sudarshan Lecture.

Similar presentations


Presentation on theme: "Distributed Databases Reference Books: An introduction to Database Systems - By C.J. Database Systems and Concepts – Silberchatz, Korth and Sudarshan Lecture."— Presentation transcript:

1 Distributed Databases Reference Books: An introduction to Database Systems - By C.J. Database Systems and Concepts – Silberchatz, Korth and Sudarshan Lecture 10 Presented By: Miss N. Nembhard

2 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 user’s own site.

3 Communication network New York Shanghai London San Francisco A typical distributed database system:

4 The Fundamental Principle of Distributed Database “To the user, a distributed system should look exactly like a non-distributed system.”

5 Distributed Database System A distributed database system consists of loosely coupled sites that share no physical component. Database systems that run on each site are independent of each other. Transactions may access data at one or more sites.

6 Homogeneous Distributed Databases In a homogeneous distributed database – All sites have identical software – Are aware of each other and agree to cooperate in processing user requests. – Each site surrenders part of its autonomy in terms of right to change schemas or software – Appears to user as a single system

7 Heterogeneous Distributed Database In a heterogeneous distributed database – Different sites may use different schemas and software Difference in schema is a major problem for query processing Difference in software is a major problem for transaction processing – Sites may not be aware of each other and may provide only limited facilities for cooperation in transaction processing

8 Distributed Data Storage Assume relational data model Replication – System maintains multiple copies of data, stored in different sites, for faster retrieval and fault tolerance. Fragmentation – Relation is partitioned into several fragments stored in distinct sites Replication and fragmentation can be combined – Relation is partitioned into several fragments: system maintains several identical replicas of each such fragment.

9 Data Replication A relation or fragment of a relation is replicated if it is stored redundantly in two or more sites. Full replication of a relation is the case where the relation is stored at all sites. Fully redundant databases are those in which every site contains a copy of the entire database.

10 Data Replication (Cont.) Advantages of Replication – Availability: failure of site containing relation r does not result in unavailability of r is replicas exist. – Parallelism: queries on r may be processed by several nodes in parallel. – Reduced data transfer: relation r is available locally at each site containing a replica of r.

11 Data Replication (Cont.) Disadvantages of Replication – Increased cost of updates: each replica of relation r must be updated. – Increased complexity of concurrency control: concurrent updates to distinct replicas may lead to inconsistent data unless special concurrency control mechanisms are implemented. One solution: choose one copy as primary copy and apply concurrency control operations on primary copy

12 Data Fragmentation Division of relation r into fragments r 1, r 2, …, r n which contain sufficient information to reconstruct relation r. Horizontal fragmentation: each tuple of r is assigned to one or more fragments Vertical fragmentation: the schema for relation r is split into several smaller schemas – All schemas must contain a common candidate key (or superkey) to ensure lossless join property. – A special attribute, the tuple-id attribute may be added to each schema to serve as a candidate key.

13 Horizontal Fragmentation of account Relation branch_name account_number balance Hillside A-305 A-226 A-155 500 336 62 account 1 =  branch_name=“Hillside” (account ) branch_name account_number balance Valleyview A-177 A-402 A-408 A-639 205 10000 1123 750 account 2 =  branch_name=“Valleyview” (account )

14 Vertical Fragmentation of employee_info Relation branch_name customer_name tuple_id Hillside Valleyview Hillside Valleyview Lowman Camp Kahn Green deposit 1 =  branch_name, customer_name, tuple_id (employee_info ) 12345671234567 account_number balance tuple_id 500 336 205 10000 62 1123 750 12345671234567 A-305 A-226 A-177 A-402 A-155 A-408 A-639 deposit 2 =  account_number, balance, tuple_id (employee_info )

15 Advantages of Fragmentation Horizontal: – allows parallel processing on fragments of a relation – allows a relation to be split so that tuples are located where they are most frequently accessed Vertical: – allows tuples to be split so that each part of the tuple is stored where it is most frequently accessed – tuple-id attribute allows efficient joining of vertical fragments – allows parallel processing on a relation Vertical and horizontal fragmentation can be mixed. – Fragments may be successively fragmented to an arbitrary depth.

16 Data Transparency Data transparency: Degree to which system user may remain unaware of the details of how and where the data items are stored in a distributed system Consider transparency issues in relation to: – Fragmentation transparency – Replication transparency – Location transparency

17 The 12 Objectives Of a Distributed Database System Local autonomy No reliance on a central site Continuous operation Location independence Fragmentation independence Replication independence Distributed query processing Distributed transaction management Hardware independence Operating system independence Network independence DBMS independence

18 Why study the 12 Objectives? --Useful as: A basis for understanding distributed technology in general A framework for characterizing the functionality of specific distributed systems.

19 Objective 1 Local Autonomy All 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.

20 Objective 2 No Reliance on a Central Site All sites must be treated as equals. There must not be any reliance on a central “master” site for some central service—for example, centralized transaction management. Two reasons: 1.The central site might be a bottleneck. 2.If the central site went down, the whole system would be down.

21 Objective 3 Continuous Operation Provide 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.

22 Objective 4 Location Independence Also 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.

23 Objective 5 Fragmentation Independence A 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

24 An example of fragmentation EMP#DEPT#SALARY E1D140K E2D142K E3D230K E4D235K E5D348K EMP#DEPT#SALARYE1D140K E2D142K E5D348K EMP#DEPT#SALARYE3D230K E4D245K Define 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 EMP New York N_EMP Shanghai S_EMP

25 Objective 6 Replication Independence A 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

26 An example of replication EMP#DEPT#SALARY E1D140K E2D142K E5D348K EMP#DEPT#SALARYE3D230K E4D235K EMP#DEPT#SALARYE3D230K E4D235K EMP#DEPT#SALARYE1D140K E2D142K E5D348K REPLICATE N_EMP AS SN_EMP AT SITE ‘Shanghai’; REPLICATE S_EMP AS NS_EMP AT SITE ‘New York’; New York N_EMP Shanghai NS_EMP (S_EMP Replica) S_EMP SN_EMP (N_EMP Replica)

27 Objective 7 Distributed Query Processing A 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.

28 Example: Consider Query “Get supplier numbers for London suppliers of red parts” Database (suppliers-and-parts, simplified): S {S#, CITY} 10,000 stored tuples at site A P {P#, COLOR} 100,000 stored tuples at site B SP {S#, P#} 1,000,000 stored tuples at site A Assume 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 = 10 Number of shipments by London suppliers = 100,000 Communication assumptions: Data rate = 50,000 bits per second Access delay = 0.1 second

29 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) 1.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.

30 Objective 8 Distributed Transaction Management Recovery 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.

31 Objective 9 Hardware Independence Real world involves a multiplicity of different machines—IBM 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.

32 Objective 10 Operating System Independence Be 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.

33 Objective 11 Network Independence Desirable to be able to support a variety of disparate communication networks also.

34 Objective 12 DBMS Independence All needed is that the DBMS instances at different sites all support the same interface– they don’t 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.

35 GATEWAY Ingres (SQL) Oracle (SQL) Ingres database Oracle database Ingres user Distributed Ingres database A hypothetical Ingres–provided gateway to Oracle: Site XSite Y

36 Thank you!


Download ppt "Distributed Databases Reference Books: An introduction to Database Systems - By C.J. Database Systems and Concepts – Silberchatz, Korth and Sudarshan Lecture."

Similar presentations


Ads by Google