Distributed Databases. Concepts. Why distributed databases? Distributed Databases Basic Concepts



Similar documents
Distributed Databases

Distributed Data Management

chapater 7 : Distributed Database Management Systems

Distributed Database Management Systems

Distributed Architectures. Distributed Databases. Distributed Databases. Distributed Databases

Chapter 3. Database Environment - Objectives. Multi-user DBMS Architectures. Teleprocessing. File-Server

Objectives. Distributed Databases and Client/Server Architecture. Distributed Database. Data Fragmentation

Evolution of Distributed Database Management System

Chapter 2: DDBMS Architecture

DISTRIBUTED AND PARALLELL DATABASE

Introduction to Parallel and Distributed Databases

B.Com(Computers) II Year DATABASE MANAGEMENT SYSTEM UNIT- V

Chapter 3: Distributed Database Design

BBM467 Data Intensive ApplicaAons

Distributed Databases in a Nutshell

TECHNIQUES FOR DATA REPLICATION ON DISTRIBUTED DATABASES

AHAIWE Josiah Information Management Technology Department, Federal University of Technology, Owerri - Nigeria jahaiwe@yahoo.

Distributed Database Management Systems for Information Management and Access

VII. Database System Architecture

Principles of Distributed Database Systems

Outline. Mariposa: A wide-area distributed database. Outline. Motivation. Outline. (wrong) Assumptions in Distributed DBMS

Topics. Distributed Databases. Desirable Properties. Introduction. Distributed DBMS Architectures. Types of Distributed Databases

An Overview of Distributed Databases

AN OVERVIEW OF DISTRIBUTED DATABASE MANAGEMENT

Optimizing Performance. Training Division New Delhi

Concepts of Database Management Seventh Edition. Chapter 9 Database Management Approaches

TOP-DOWN APPROACH PROCESS BUILT ON CONCEPTUAL DESIGN TO PHYSICAL DESIGN USING LIS, GCS SCHEMA

A Multidatabase System as 4-Tiered Client-Server Distributed Heterogeneous Database System

Introduction to Databases

Distributed Database Systems

IV Distributed Databases - Motivation & Introduction -

Distributed Databases

Fragmentation and Data Allocation in the Distributed Environments

H4 DATABASE DEVELOPMENT SOLUTIONS & MARKING SCHEME JUNE 2013

When an organization is geographically dispersed, it. Distributed Databases. Chapter 13-1 LEARNING OBJECTIVES INTRODUCTION

Chapter 18: Database System Architectures. Centralized Systems

Database Management. Chapter Objectives

Cloud DBMS: An Overview. Shan-Hung Wu, NetDB CS, NTHU Spring, 2015

Distributed Systems LEEC (2005/06 2º Sem.)

Transaction Management Overview

Tier Architectures. Kathleen Durant CS 3200

Transaction Management in Distributed Database Systems: the Case of Oracle s Two-Phase Commit

Transaction Processing Monitors

SODDA A SERVICE-ORIENTED DISTRIBUTED DATABASE ARCHITECTURE

CHAPTER 1: OPERATING SYSTEM FUNDAMENTALS

Physical Database Design and Tuning

1. Physical Database Design in Relational Databases (1)

Introduction to Database Systems

Mobile and Heterogeneous databases Database System Architecture. A.R. Hurson Computer Science Missouri Science & Technology

Outline. Distributed DBMSPage 4. 1

Distributed Databases

Centralized Systems. A Centralized Computer System. Chapter 18: Database System Architectures

Comp 5311 Database Management Systems. 16. Review 2 (Physical Level)

Principles and characteristics of distributed systems and environments

A Review of Database Schemas

Physical DB design and tuning: outline

Distributed and Parallel Database Systems

Structured Query Language (SQL)

In Memory Accelerator for MongoDB

Distributed Databases

Chapter Outline. Chapter 2 Distributed Information Systems Architecture. Middleware for Heterogeneous and Distributed Information Systems

Lecture 7: Concurrency control. Rasmus Pagh

MS SQL Performance (Tuning) Best Practices:

Concepts of Database Management Seventh Edition. Chapter 7 DBMS Functions

A Shared-nothing cluster system: Postgres-XC

BCA. Database Management System

Client/Server and Distributed Computing

Transactions and the Internet

International Journal of Advanced Research in Computer Science and Software Engineering

ICOM 6005 Database Management Systems Design. Dr. Manuel Rodríguez Martínez Electrical and Computer Engineering Department Lecture 2 August 23, 2001

Distributed System Principles

Parallel Databases. Parallel Architectures. Parallelism Terminology 1/4/2015. Increase performance by performing operations in parallel

Steps to System Reconfiguration in a Distributed Database System: A Fault-tolerant Approach

Data Center Infrastructure

Bridge from Entity Relationship modeling to creating SQL databases, tables, & relations

Distributed Database Management Systems

Chapter 22: Distributed Databases

Client Server Architecture

Chapter 2 Database System Concepts and Architecture

Client/Server Computing Distributed Processing, Client/Server, and Clusters

Exploiting Remote Memory Operations to Design Efficient Reconfiguration for Shared Data-Centers over InfiniBand

Technologies & Applications

Basic Concepts of Database Systems

Comparing Microsoft SQL Server 2005 Replication and DataXtend Remote Edition for Mobile and Distributed Applications

Principles for Distributed Databases in Telecom Environment Imran Ashraf Amir Shahzed Khokhar

Oracle Database Links Part 2 - Distributed Transactions Written and presented by Joel Goodman October 15th 2009

Introduction to Database Systems. Chapter 1 Introduction. Chapter 1 Introduction

Microsoft SQL Server for Oracle DBAs Course 40045; 4 Days, Instructor-led

Availability Digest. Raima s High-Availability Embedded Database December 2011

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Fall 2007 Lecture 5 - DBMS Architecture

The ConTract Model. Helmut Wächter, Andreas Reuter. November 9, 1999

SQL Server 2012 Optimization, Performance Tuning and Troubleshooting

Distribution transparency. Degree of transparency. Openness of distributed systems

XTM Web 2.0 Enterprise Architecture Hardware Implementation Guidelines. A.Zydroń 18 April Page 1 of 12

Topics. Introduction to Database Management System. What Is a DBMS? DBMS Types

Introduction to Database Systems. Module 1, Lecture 1. Instructor: Raghu Ramakrishnan UW-Madison

Transcription:

Distributed Databases Basic Concepts Distributed Databases Concepts. Advantages and disadvantages of distributed databases. Functions and architecture for a DDBMS. Distributed database design. Levels of transparency. Comparison criteria for Distributed DBMSs. Connolly & Begg. Chapter 22. Third edition Why distributed databases? Concepts Some initial motivations: The development of computer networks promotes decentralization. In a company, the database organization might reflect the organizational structure, which is distributed into units. Each unit maintains its own database. Sharing of data can be achieved by developing a distributed database system which: makes data accessible by all units stores data close to where it is most frequently used. Distributed Database A logically interrelated collection of shared data (and a description of this data), physically distributed over a computer network. Distributed DBMS (DDBMS) Software system that permits the management of the distributed database and makes the distribution transparent to users. 3

An example of DDBMS DDBMS - characteristics Collection of logically-related shared data. Data split into fragments. Fragments may be replicated. Fragments/replicas allocated to sites. Sites linked by a communications network. Data at each site is under control of a DBMS. DBMSs handle local applications autonomously. Each DBMS participates in at least one global application. 4 These are not DDBMSs Distributed Processing A centralized database that can be accessed over a computer network. These are not DDBMSs Parallel DBMS A DBMS running across multiple processors and disks designed to execute operations in parallel, whenever possible, to improve performance. Based on premise that single processor systems can no longer meet requirements for cost-effective scalability, reliability, and performance. Parallel DBMSs link multiple, smaller machines to achieve same throughput as single, larger machine, with greater scalability and reliability. 6 7

Parallel DBMS Parallel DBMS Main architectures for parallel DBMSs are: Shared memory, Shared disk, Shared nothing. (a) shared memory (b) shared disk (c) shared nothing Advantages of DDBMSs Reflects Organizational Structure Improved Sharing and Local Autonomy Improved Availability A failure does not make the entire system inoperable Improved Reliability Data may be replicated Improved Performance Data are local to the site of greatest demand Economics Many small computers cost less than a big one! Modular Growth easy to add new modules Disadvantages of DDBMSs Complexity Cost Especially in system management Security network must be made secure Integrity Control More Difficult Lack of Standards Lack of Experience Database Design More Complex due to fragmentation, allocation of fragments to a specific site,.. 10 11

Types of DDBMS Homogeneous DDBMS All sites use same DBMS product (eg.oracle) Fairly easy to design and manage. Heterogeneous DDBMS Sites may run different DBMS products (eg. Oracle and Ingress) Possibly different underlying data models (eg. relational DB and OO database) Occurs when sites have implemented their own databases and integration is considered later. We won t consider heterogeneous DDBMSs here. Multidatabase System (MDBS) DDBMS in which each site maintains complete autonomy. DBMS that resides transparently on top of existing database and file systems and presents a single database to its users. Allows users to access and share data without requiring physical database integration. Unfederated MDBS (no local users) and federated MDBS. 12 Overview of Networking Overview of Networking Network - Interconnected collection of autonomous computers, capable of exchanging information. Local Area Network (LAN) intended for connecting computers at same site. Wide Area Network (WAN) used when computers or LANs need to be connected over long distances. WAN relatively slow and less reliable than LANs. DDBMS using LAN provides much faster response time than one using WAN.

Functions of a DDBMS Reference Architecture for DDBMS Expect DDBMS to have at least the functionality of a DBMS (see Connolly & Begg. Chapter 2. Third edition) Also to have following functionality: Extended communication services. Extended Data Dictionary. Distributed query processing. Extended concurrency control. Extended recovery services. Extended security control. Due to diversity, no accepted architecture equivalent to ANSI/SPARC 3-level architecture for DBMSs. A possible reference architecture consists of: Set of global external schemas. Global conceptual schema (GCS). Fragmentation schema and allocation schema. Set of schemas for each local DBMS conforming to 3-level ANSI/SPARC. Some levels may be missing, depending on levels of transparency supported. Reference Architecture for DDBMS Reference Architecture for DDBMS Global Conceptual Schema is the logical description of the DB as if it were not distributed. It contains definitions of entities, relationships, constraints, security, and integrity information. Fragmentation and Allocation Schemas describe how data are logically partitioned, and where they are located, taking replication into account. Local Schemas are the logical descriptions of the local DBs.

Components of a DDBMS Distributed Databases Issues in Distributed Database Design Issues in Distributed Database Design Three key issues we have to consider: Data Allocation: where are data placed? Data should be stored at site with "optimal" distribution. Fragmentation: relation may be divided into a number of sub-relations (called fragments), which are stored in different sites. Replication: copy of fragment may be maintained at several sites. Issues in Distributed Database Design Definition and allocation of fragments carried out strategically to achieve: Locality of Reference Improved Reliability and Availability Improved Performance Balanced Storage Capacities and Costs Minimal Communication Costs. Involves analysing most important transactions, based on quantitative/qualitative information. 27

Fragmentation Data Allocation Quantitative information may include: frequency with which a transaction is run; site from which a transaction is run; performance criteria for transactions. Qualitative information may include transactions that are executed such as: type of access (read or write); predicates of read operations. Four strategies regarding placement of data: Centralized Partitioned (or Fragmented) Complete Replication Selective Replication 30 Data Allocation Fragmentation Centralized: Consists of single database stored at one site with users distributed across the network. (This is not a DDB but distributed processing!!) Partitioned: Database partitioned into disjoint fragments, each fragment assigned to one site. Complete Replication: Consists of maintaining complete copy of database at each site. Selective Replication:Combination of partitioning, replication, and centralization. A relation R is divided into fragments r 1, r 2, r n, which contain enough information to allow reconstruction of R Example: We have a relation Sells(pub, address,price,type) Type is bitter or lager. We can split Sells into twp dfferent fragments: SellsBitter= σ type = bitter (Sells) SellsLager= σ type = lager (Sells) 31 28

Comparison of Strategies for Data Distribution Why Fragment? Usage Applications work with views rather than entire relations. Efficiency Data is stored close to where it is most frequently used. Data that is not needed by local applications is not stored Parallelism With fragments as unit of distribution, transaction can be divided into several sub-queries that operate on fragments. Security Data not required by local applications is not stored and so not available to unauthorized users. Why Fragment? Types of Fragmentation Two main disadvantages: Performance Integrity. Four types of fragmentation: Horizontal, Vertical, Mixed, Derived. Other possibility is no fragmentation: If relation is small and not updated frequently, may be better not to fragment relation. Pearson Education Limited 1995, 2005

Horizontal and Vertical Fragmentation Mixed Fragmentation Two types of fragmentation: Horizontal Vertical Pearson Education Limited 1995, 2005 Horizontal Fragmentation Horizontal Fragmentation Each fragment consists of a subset of the tuples of a relation R. Defined using Selection operation of relational algebra: σ p (R) Example: Relation: Sells(pub, address,price,type) Fragments:» SellsBitter= σ type = bitter (Sells)» SellsLager= σ type = lager (Sells) This strategy is determined by looking at predicates used by transactions. Involves finding set of minimal (complete and relevant) predicates. Set of predicates is complete, if and only if, any two tuples in same fragment are referenced with same probability by any application. Predicate is relevant if there is at least one application that accesses fragments differently. 43

Vertical Fragmentation Each fragment consists of a subset of attributes of a relation R. Defined using projection operation of relational algebra: Π a1, a n (R) Determined by establishing affinity of one attribute to another. Example: Relation: Bars(name,address,licence,employees,owner) Fragments:» Π name,address,licence (Bars)» Π name,address,employees,owner (Bars) Mixed Fragmentation We can also mix horizontal and vertical fragmentation. We obtain a fragment that consist of an horizontal fragment that is vertically fragmented, or a vertical fragment that is horizontally fragmented. Defined using Selection and Projection operations of relational algebra. σ p (Π a1, a n (R)) Π a1, a n (σ p (R)) 45 46 Example - Mixed Fragmentation Derived Horizontal Fragmentation S 1 = staffno, position, sex, DOB, salary (Staff) S 2 = staffno, fname, lname, branchno (Staff) S 21 = σ branchno= B003 (S 2 ) S 22 = σ branchno= B005 (S 2 ) S 23 = σ branchno= B007 (S 2 ) A horizontal fragment that is based on horizontal fragmentation of a parent relation. Ensures that fragments that are frequently joined together are at same site. Defined using Semijoin operation of relational algebra: R i = R > F S i, 1 i w

Example - Derived Horizontal Fragmentation Derived Horizontal Fragmentation S 3 = σ branchno= B003 (Staff) S 4 = σ branchno= B005 (Staff) S 5 = σ branchno= B007 (Staff) Could use derived fragmentation for Property: If relation contains more than one foreign key, need to select one as parent. Choice can be based on fragmentation used most frequently or fragmentation with better join characteristics. P i = PropertyForRent > branchno S i, 3 i 5 How can we define fragments correctly? Correctness of Fragmentation In defining fragments we have to be very careful. Three correctness rules: Completeness Reconstruction Disjointness. Completeness: If relation R is decomposed into fragments r 1, r 2, r n, each data item that can be found in R must appear in at least one fragment. This ensures no loss of data during fragmentation. 37 38

Correctness of Fragmentation Correctness of Fragmentation Recostruction: we must be able to reconstruct the entire R from fragments. For horizontal fragmentation is union operation. R = r 1 r 2 r n, For vertical fragmentation is natural join operation. R = r 1 >< r 2 >< >< r n, To ensure reconstruction we have to include primary key attributes in all fragments. Disjointness: if data item x appears in fragment r i, then it should not appear in any other fragment. Exception: vertical fragmentation, where primary key attributes must be repeated to allow reconstruction. For horizontal fragmentation, data item is a tuple For vertical fragmentation, data item is an attribute. 39 Correctness of Horizontal Fragmentation Correctness of Vertical Fragmentation Relation: Sells(pub, address,price,type) type={bitter, Lager} Fragments: SellsBitter= σ type = bitter (Sells) SellsLager= σ type = lager (Sells) Correctness rules Completeness: Each tuple in the relation appears either in SellsBitter, or in SellsLager Reconstruction: The Sells relation can be reconstructed from the fragments Sells = SellsBitter SellsLager Disjointness: The two fragments are disjoint, there can be no beer that is both Lager and Bitter Relation: Bars(name,address,licence,employees,owner) Fragments: r 1 =Π name,address,licence (Bars) r 2 = Π name,address,employees,owner (Bars) Correctness rules Completeness: Each attribute in the Bars relation appears either in r 1 or in r 2 Reconstruction: The Bars relation can be reconstructed from the fragments Bars = r 1 >< r 2 Disjointness: The two fragments are disjoint, except for the primary key, name, which is necessary for reconstruction 43 43

Transparencies in a DDBMS Distribution Transparency Distributed Databases Transaction Transparency Performance Transparency DBMS Transparency Transparency in Distributed databases Distribution Transparency Naming Transparency The user has to perceive the DDB as a single, logical entity Fragmentation Transparency: the user does not need to know that data is fragmented Location Transparency: the user does not need to know the location of data items Replication Transparency: the user is unaware of relication of data. Naming transparency: items in a database must have a unique name, but users don t need to worry about it. Each item in a DDB must have a unique name. DDBMS must ensure that no two sites create a database object with same name. Solution 1: create central name server. Disadvantages: loss of some local autonomy; central site may become a bottleneck; low availability; if the central site fails, remaining sites cannot create any new objects. 51 54

Naming Transparency Solution 2: prefix object with identifier of site that created it. Example: Beer created at site S1 might be named S1.Beer. Disadvantage: loss of distribution transparency. Naming Transparency Solution 3: use aliases for each database object. Example: S1.Beer might be known as local_beer by user at site S1. The DDBMS has task of mapping an alias to appropriate database object. 55 56 Transaction Transparency Example - Distributed Transaction Ensures that all distributed transactions maintain distributed database s integrity and consistency. Distributed transaction accesses data stored at more than one location. Each transaction is divided into number of subtransactions, one for each site that has to be accessed. DDBMS must ensure the indivisibility of both the global transaction and each sub-transactions. Must ensure both concurrency transparency, and failure transparency Relation: Sells(pub, beer,price,type) Fragments: SellsBitter= σ type = bitter (Sells) SellsLager= σ type = lager (Sells) The two fragments are at two different sites. Transaction T prints out the names of all pubs in the relation sells. This transaction is split into two sub-transactions, one for each fragment. 57 58

Example - Distributed Transaction Concurrency Transparency T prints out names of all staff, using schema defined above as S 1, S 2, S 21, S 22, and S 23. Define three subtransactions T S3, T S5, and T S7 to represent agents at sites 3, 5, and 7. All transactions must execute independently and be logically consistent with results obtained if transactions executed one at a time, in some arbitrary serial order. Same fundamental principles as for centralised DBMS. DDBMS must ensure both global and local transactions do not interfere with each other. Similarly, DDBMS must ensure consistency of all subtransactions of global transaction. Techniques for concurrency control. Usually different from the ones for DBMS. 59 Concurrency Transparency Concurrency Transparency Replication makes concurrency more complex. If a copy of a replicated data item is updated, update must be propagated to all copies. Could propagate changes as part of original transaction, making it an atomic operation. However, if one site holding copy is not reachable, then transaction is delayed until site is reachable. Could limit update propagation to only those sites currently available. Remaining sites updated when they become available again. Could allow updates to copies to happen asynchronously, sometime after the original update. Delay in regaining consistency may range from a few seconds to several hours.

Failure Transparency DDBMS must ensure atomicity and durability of global transaction. Means ensuring that sub-transactions of global transaction either all commit or all abort. Thus, DDBMS must synchronize global transaction to ensure that all sub-transactions have completed successfully before recording a final COMMIT for global transaction. Must do this in presence of site and network failures. Performance Transparency DDBMS must perform as if it were a centralized DBMS: DDBMS should not suffer any performance degradation due to distributed architecture. DDBMS should determine most cost-effective strategy to execute a request. 63 Performance Transparency Distributed Query Processor (DQP) maps data request into ordered sequence of operations on local databases. It must consider fragmentation, replication, and allocation schemas. DQP has to decide: which fragment to access; which copy of a fragment to use; which location to use. Performance Transparency DQP produces execution strategy optimised with respect to some cost function. Typically, costs associated with a distributed request include: I/O cost; CPU cost; communication cost. 64 65

Performance Transparency - Example Property(Pno, City) 10000 records in London Renter(Rno,Max_Price) 100000 records in Glasgow Viewing(Pno, Rno) 1000000 records in London SELECT p.pno FROM property p INNER JOIN (renter r INNER JOIN viewing v ON r.rno = v.rno) ON p.pno = v.pno WHERE p.city= Aberdeen AND r.max_price > 200000; Performance Transparency - Example Assume: Each tuple in each relation is 100 characters long. 10 renters with maximum price greater than 200,000. 100 000 viewings for properties in Aberdeen. Computation time negligible compared to communication time. 66 67 Performance Transparency - Example Date s 12 Rules for a DDBMS 0. Fundamental Principle To the user, a distributed system should look exactly like a non-distributed system. 1. Local Autonomy 2. No Reliance on a Central Site 3. Continuous Operation 4. Location Independence 5. Fragmentation Independence 6. Replication Independence 68 69

Date s 12 Rules for a DDBMS Distributed Transaction Management 0. Fundamental Principle To the user, a distributed system should look exactly like a nondistributed system. 7. Distributed Query Processing 8. Distributed Transaction Processing 9. Hardware Independence 10. Operating System Independence 11. Network Independence 12. Database Independence DDBMS must ensure: synchronization of sub-transactions with other local transactions executing concurrently at a site; synchronization of sub-transactions with global transactions running simultaneously at same or different sites. Global transaction manager (transaction coordinator) at each site, to coordinate global and local transactions initiated at that site. Note: last four rules are ideal! 69 4 Distributed Concurrency Control Techniques for Distributed Concurrency Control must ensure distributed serializability. Locking protocols (extensions of 2PL protocol) Distributed Deadlock management. Timestamping methods (extend the definition of timestamp so that it includes a site identifier)