4 Distributed DBMS Architecture Chapter 4 Distributed DBMS
4. Distributed DBMS Architecture Chapter 4 Distributed DBMS Architecture 1
Outline v To-Down Design of DDBMS Architecture w Schema and Distribution Transparency v Bottom-up Design of DDBMS Architecture w Architectural Alternatives for DDBMSs w Three Reference Architectures for a DDBMS (i. e. , client/server, peer-to-peer distributed DBMS, multi-databases) v Global Directory/Dictionary 2
Introduction v Architecture defines the structure of the system w components identified w functions of each component defined w interrelationships and interactions between components defined 3
Reference Model(参考模型) v Reference Model w A conceptual framework whose purpose is to divide standardization work into manageable pieces and to show at a general level how these pieces are related to one another. v Three approaches to define a reference model ① Component-based – Components of the system are defined together with the interrelationships between components – Good for design and implementation of the system 4
Reference Model (cont. ) ② Function-based – Classes of users are identified together with the functionality that the system will provide for each class – The objectives of the system are clearly identified. But how do you achieve these objectives? ③ Data-based – Identify different types of data and specify the functional units that will realize and/or use data according to these views. – The ANSI/SPARC architecture discussed next belongs to this category. 5
ANSI/SPARC Architecture Users External Schema Conceptual Schema Internal Schema External View Conceptual View Internal View 6
Conceptual Schema (概念模式) RELATION EMP [ KEY = {ENO} ATTRIBUTES = { RELATION PAY [ KEY = {TITLE} ATTRIBUTES = { ENO : CHARACER(9) ENAME : CHARACER(15) TITLE : CHARACER(10) SAL : NUMERIC(6) } } ] ] RELATION PROJECT [ KEY = {PNO} ATTRIBUTES = { RELATION ASG [ KEY = {ENO, PNO} ATTRIBUTES = { ENO : CHARACER(9) PNO : CHARACER(7) RESP : CHARACER(10) DUR : NUMERIC(6) PNO : CHARACER(7) PNAME : CHARACER(20) BUDGET : NEMERIC(7) } } ] ] 7
Internal Schema (内部模式) RELATION EMP [ KEY = {ENO} ATTRIBUTES = { ENO : CHARACER(9) ENAME : CHARACER(15) TITLE : CHARACER(10) } ] INTERNAL_REL EMPL [ INDEX ON E# CALL EMINX FIEDLS = { HEADER : BYTE(1) E# : BYTE(9) ENAME : BYTE(15) TIT : BYTE(10) } ] 8
External View(外部模式 ) – Example 1 Create a BUDGET view from the PROJ relation CREAT VIEW AS SELECT FROM BUDGET(PNAME, BUD) PNAME, BUDGET PROJ 9
External View(外部模式 ) – Example 2 Create a Payroll view from relations EMP and PAY CREAT VIEW AS SELECT FROM WHERE PAYROLL(ENO, ENAME, SAL) EMP. ENO, EMP. ENAME, PAY. SAL EMP, PAY EMP. TITLE = PAY. TITLE 10
The Top-Down Classical DDBMS Architecture Global Schema Fragmentation Schema Site Independent Schemas Allocation Schema Local Mapping Schema Site 1 Local Mapping Schema DBMS 1 DBMS 2 LOCA L DB 1 LOCA L DB 2 Site 2 Other sites 11
Global Relations, Fragments, and Physical Images R R 1 R 2 R 1 1 R 1 2 R 2 1 R 3 Global Relation R 2 2 R 3 2 Fragments R 3 3 R 1 (Site 1) R 2 (Site 2) R 3 (Site 3) Physical Images 12
DDBMS Schemas v Global Schema: a set of global relations as if database were not distributed at all v Fragmentation Schema: global relation is split into “nonoverlapping” (logical) fragments. 1: n mapping from relation R to fragments Ri. v Allocation Schema: 1: 1 or 1: n (redundant) mapping from fragments to sites. All fragments corresponding to the same relation R at a site j constitute the physical image Rj. A copy of a fragment is denoted by Rji. v Local Mapping Schema: a mapping from physical images to physical objects, which are manipulated by local 13 DBMSs.
Motivation for this Architecture v Separating the concept of data fragmentation from the concept of data allocation v Fragmentation transparency v Location transparency v Explicit control of redundancy v Independence from local databases allows local mapping transparency 14
Rules for Data Fragmentation v Completeness All the data of the global relation must be mapped into the fragments. v Reconstruction It must always be possible to reconstruct each global relation from its fragments. v Disjointedness It is convenient that fragments are disjoint, so that the replication of data can be controlled explicitly at the allocation level. 15
Types of Data Fragmentation Vertical Fragmentation • Projection on relation (subset of attributes) • Reconstruction by join • Updates require no tuple migration Horizontal Fragmentation • Selection on relation (subset of tuples) • Reconstruction by union • Updates may require tuple migration Mixed Fragmentation • A fragment is a Select Project query on relation. 16
Horizontal Fragmentation (水平划分) v Partitioning the tuples of a global relation into subsets Example: Supplier (SNum, Name, City) Horizontal Fragmentation can be: Supplier 1 = City = ``HK'' Supplier 2 = City != “HK” Supplier Reconstruction is possible: Supplier = Supplier 1 Supplier 2 v The set of predicates defining all the fragments must be complete, and mutually exclusive 17
Derived Horizontal Fragmentation v The horizontal fragmentation is derived from the horizontal fragmentation of another relation Example: Supply (SNum, PNum, Dept. Num, Quan) SNum is a supplier number Supply 1 = Supply SNum=SNum Supplier 1 Supply 2 = Supply SNum=SNum Supplier 2 is the semi join operation. The predicates defining derived horizontal fragments are: (Supply. SNum = Supplier. SNum) and (Supplier. City = ``HK'') (Supply. SNum = Supplier. SNum) and (Supplier. City != ``HK'') 18
Vertical Fragmentation (垂直划分) v The vertical fragmentation of a global relation is the subdivision of its attributes into groups; fragments are obtained by projecting the global relation over each group Example EMP (ENum, Name, Sal, Tax, MNum, DNum) A vertical fragmentation can be EMP 1 = ENum, Name, MNum, DNum EMP 2 = ENum, Sal, Tax EMP Reconstruction: EMP = EMP 1 ENum = ENum EMP 2 19
Distribution Transparency (分布透明 ) v Different levels of distribution transparency can be provided by DDBMS for applications. A Simple Application Supplier(SNum, Name, City) Horizontally fragmented into: Supplier 1 = City = ``HK'' Supplier at Site 1 Supplier 2 = City != “HK” Supplier at Site 2, Site 3 Application: Read the supplier number from the user and return the name of the supplier with that number. 20
Level 1 of Distribution Transparency Fragmentation transparency: read (terminal, $SNum); Select Name into $Name from Supplier where SNum = $SNum; write (terminal, $Name). Supplier 1 Supplier 2 S 3 DDBMS The DDBMS interprets the database operation by accessing the databases at different sites in a way which is completely determined by the system. 21
Level 2 of Distribution Transparency Location Transparency read (terminal, $SNum); Select Name into $Name from Supplier 1 where SNum = $SNum; If not FOUND then Select Name into $Name from Supplier 2 where SNum = $SNum; write (terminal, $Name). Supplier 1 Supplier 2 S 3 DDBMS The application is independent from changes in allocation schema, but not from changes to fragmentation schema. 22
Level 3 of Distribution Transparency Local Mapping Transparency read (terminal, $SNum); Select Name into $Name from S 1. Supplier 1 where SNum = $SNum; If not FOUND then Select Name into $Name from S 3. Supplier 2 where SNum = $SNum; write (terminal, $Name). Supplier 1 Supplier 2 S 3 DDBMS The applications have to specify both the fragment names and the sites where they are located. The mapping of database operations specified in applications to those in DBMSs at sites is transparent. 23
Level 4 of Distribution Transparency v No Transparency read (terminal, $SNum); $Sup. IMS($Snum, $Name, $Found) at S 1; If not FOUND then $Sup. CODASYL($Snum, $Name, $Found) at S 3; write (terminal, $Name). DDBMS Codasyl IMS Supplier 2 Supplier 1 S 3 S 1 24
Distribution Transparency for Updates Difficult • broadcasting updates to all copies EMP 1 = ENum, Name, Sal, Tax DNum 10 (EMP) EMP 2 = ENum, MNum, DNum 10 (EMP) EMP 3 = ENum, Name, DNum Dnum>10 (EMP) EMP 4 = ENum, MNum, Sal, Tax Dnum>10 (EMP) EMP 1 • migration of tuples because of change of fragment defining EMP 3 attributes EMP 2 Update Dnum=15 for Employee with Enum=100 EMP 4 25
An Update Application UPDATE EMP SET DNum = 15 WHERE ENum = 100; With Level 1 Fragmentation Transparency With Level 2 Location Transparency only Select Name, Tax, Sal into $Name, $Sal, $Tax From EMP 1 Where ENum = 100; Select MNum into $MNum From EMP 2 Where ENum = 100; Insert into EMP 3 (ENum, Name, DNum) (100, $Name, 15); Insert into EMP 4 (ENum, Sal, Tax, MNum) (100, $Sal, $Tax, $MNum); Delete EMP 1 where ENum = 100; Delete EMP 2 where ENum = 100; 26
Levels of Distribution Transparency v Fragmentation Transparency w Just like using global relations v Location Transparency w Need to know fragmentation schema; but no need to know where fragments are located w Applications access fragments (no need to specify sites where fragments are located). v Local Mapping Transparency w Need to know both fragmentation and allocation schema; no need to know what the underlying local DBMSs are. w Applications access fragments explicitly specifying where the fragments are located. v No Transparency w Need to know local DBMS query languages, and write applications using functionality provided by the Local DBMS 27
On Distribution Transparency v v v More distribution transparency requires appropriate DDBMS support, but makes end-application developers’ work easy. The less distribution transparency, the more the endapplication developer needs to know about fragmentation and allocation schemes, and how to maintain database consistency. There are tough problems in query optimization and transaction management that need to be tackled (in terms of system support and implementation) before fragmentation transparency can be supported. 28
Layers of Transparency v The level of transparency is inevitably a compromise between ease of use and the difficulty and overhead cost of providing high levels of transparency v DDBMS provides fragmentation transparency and location transparency; OS provides network transparency; and DBMS provides data independence 29
Some Aspects of the Classical DDBMS Architecture v Distributed database technology is an “add-on” technology, and most users already have populated centralized DBMSs. Whereas top-down design assumes implementation of new DDBMS from scratch. v In many application environments, such as semistructured databases, continuous/streaming multimedia data, the notion of fragment is difficult to define. 30
Bottom-up Architectural Models for DDBMS Possible ways in which multiple databases are put together for sharing, which are characterized according to three dimensions. Distribution Peer-to-peer Distributed DBMS Distributed Multi-DBMS Client/server Autonomy Multi-DBMS Heterogeneity Federated DBMS 31
Dimension 1: Distribution (分布) v Whether the components of the system are located on the same machine or not w 0 - no distribution - single site (D 0) w 1 - client-server - distribution of DBMS functionality (D 1) w 2 - full distribution - peer to peer distributed architecture(D 2) 32
Dimension 2: Heterogeneity (异质) v Various levels (hardware, communication, operating system) v DBMS important ones (like data model, query language, transaction management algorithms, etc. ) w 0 - homogeneous (H 0) w 1 - heterogeneous (H 1) 33
Dimension 3: Autonomy (自治) v v Refers to the distribution of control, not of data, indicating the degree to which individual DBMSs can operate independently. Requirements of an autonomous system w The local operations of the individual DBMSs are not affected by their participation in the DDBS. w The individual DBMS query processing and optimization should not be affected by the execution of global queries that access multiple databases. w System consistency or operation should not be compromised when individual DBMSs join or leave the distributed database confederation. 34
Various Versions of Autonomy v Design autonomy w Ability of a component DBMS to decide on issues related to its own design w Freedom for individual DBMSs to use data models and transaction management techniques they prefer v Communication autonomy w Ability of a component DBMS to decide whether and how to communication with other DBMSs w Freedom for individual DBMSs to decide what information (data & control) is to be exported v Execution autonomy w Ability of a component DBMS to execute local operations in any manner it wants to. w Freedom for individual DBMSs to execute transactions submitted in any way that it wants to 35
Dimension 3: Autonomy (cont. ) w 0 – Tightly coupled - integrated (A 0) w 1 – Semi-autonomous - federated (A 1) w 2 – Total Isolation - multidatabase systems (A 2) 36
Time Sharing Access to a Central Database (Distribution) • No data storage • Host running all software Batch requests Terminals response Network Communications Application Software DBMS Services Database 37
Multiple Clients / Single Server Applications Client Services Communications High-level requests Communications Filtered data only LAN DBMS Services Database 38
Task Distribution Applications SQL Interface … Programmatic Interface Communication Manager SQL query result table Communication Manager Query Optimizer Lock Manager Storage Manager Page & Cache Manager Database 39
Advantages of Client-Server Architectures More efficient division of labor v Horizontal and vertical scaling of resources v Better price/performance on client machines v Ability to use familiar tools on client machines v Client access to remote data (via standards) v Full DBMS functionality provided to client workstations v Overall better system price/performance v 40
Problems with Multiple-Clients / Single Server Architectures Server forms bottleneck v Server forms single point of failure v Database scaling difficult v 41
Multiple Clients / Multiple Servers • Directory • Caching • Query decomposition • Commit protocols Applications Client Services Communications DBMS Services Database LAN 42
Server to Server • SQL interface • Programmatic interface • other application support environments Applications Client Services Communications DBMS Services Database LAN 43
Operating System Components of Client / Server Architecture Application Program Client DBMS Communication software UI Operating System SQL Queries Communication software Semantic Data Controller Result Relation Query Optimizer Transaction Manager Recovery Manager Runtime Support Processor System Database 44
Global Schema log Local Internal Schema Runtime Support GD/D Local Conceptual Schema Local Recovery Manager USER PROCESSOR Local Query Processor Global Execution Monitor External Schema Global Query Optimizer Semantic Data Controller User Interface Handler Peer-to-Peer Component Architecture DATA PROCESSOR 45
User Processor Component User interface handler interprets user commands and formats the result data as it is sent to the user. v Semantic data controller checks the integrity constraints and authorization requirements. v Global query optimizer and decomposer determines execution strategy, translates global queries to local queries, and generates strategy for distributed join operations. v Global execution monitor (distributed transaction manager) coordinates the distributed execution of the user request. v 46
Data Processor Component v Local query processor selects the access path and is involved in local query optimization and join operations. v Local recovery manager maintains local database consistency. v Run-time support processor physically accesses the database. It is the interface to the OS and contains database buffer manager. 47
Taxonomy of Distributed Databases (Autonomy) v Composite DBMSs - tight integration w single image of entire database is available to any user w can be single or multiple sites w can be homogeneous or heterogeneous v Federated DBMSs - semiautonomous w DBMSs that can operate independently, but have decided to make some parts of their local data shareable w can be single or multiple sites. w they need to be modified to enable them to exchange information v Multidatabase Systems - total isolation w individual systems are stand alone DBMSs, which know neither the existence of other databases or how to communicate with them w no global control over the execution of individual DBMSs. w can be single or multiple sites w homogeneous or heterogeneous 48
Distributed Database Reference Architecture ES 1 ES 2 ESn External Schema Global Conceptual Schema GCS LCS 1 LCS 2 LCSn Local Conceptual Schema LIS 1 LIS 2 LISn Local Internal Schema It is logically integrated. Provides for the levels of transparency 49
Components of a Multi-DBMS User System Responses User Requests Multi-DBMS Layer User Interface Transaction Manager User Interface Query Processor Scheduler Query Processor Query Optimizer Recovery Manager Query Optimizer Runtime Sup. Processor Database 50
Multi-DBMS Architecture with a Global Conceptual Schema ES 1 LES 1 s ES 2 ESn GCS LESn 1 LCSn LIS 1 LISn LESnt • The GCS is generated by integrating LES's or LCS's • The users of a local DBMS can maintain their autonomy • Design of GCS is bottom up 51
Multi-DBMS without Global Conceptual Schema Multidatabase Layer ES 1 ES 2 ES 3 Local Database System Layer LCS 1 LCS 2 LCS 3 LIS 1 LIS 2 LIS 3 Local database system layer consists of several DBMSs which present to multidatabase layer part of their databases v The shared database has either local conceptual schema or external schema (Not shown in the figure) v External views on one or more LCSs. v Access to multiple databases through application programs v 52
Multi-DBMS without Global Conceptual Schema (cont. ) v Multi-DBMS components architecture w Existence of fully fledged local DBMSs w Multi-DBMS is a layer on top of individual DBMSs that support access to different databases w The complexity of the layer depends on existence of GCS and heterogeneity v Federated Database Systems w w Do not use global conceptual schema Each local DBMS defines export schema Global database is a union of export schemas Each application accesses global database through import schema (external view) 53
Global Directory/Dictionary v Directory is itself a database that contains meat -data about the actual data stored in the database. It includes the support for fragmentation transparency in the classical DDBMS architecture. v Directory can be local or distributed. v Directory can be replicated and/or partitioned. v Directory issues are very important for large multi-database applications, such as digital libraries. 54
Alternative Directory Management Strategies Global and central and nonreplicated Local and central and replicated Global and central and replicated Replication Type Local and central and nonreplicated Local and distribute and nonreplicated Global and distribu and nonreplicated Location Local and distributed and replicated Global and distributed and replicated 55
Question & Answer 56
- Slides: 56