You are on page 1of 41

Distributed Databases

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


•Less reliable than LANs.
•DDBMS using LAN provides much faster response time than
one using WAN.
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


•Less reliable than LANs.
•DDBMS using LAN provides much faster response time than
one using WAN.
Concepts Of Databases and
networks:
1. A centralized DBMS could be physically processed by several
computers distributed across a network
2. There could be several separate DBMS on several computers
distributed across a network
3. There may be a Distributed DBMS (DDBMS)
• made up of several DBMSs distributed across a network
• each with local autonomy
• Each participates in at least one global DBMS action
• The DDBMS therefore can operate as a single global DBMS
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.
A typical distributed database system:

New York
Shanghai

Communication
network

London San Francisco


Concepts

DDBMS has following characteristics:


•Data at each site is under
•Collection of logically-related shared data. control of a DBMS.
•Data split into fragments. •DBMSs handle local
•Fragments may be replicated. applications autonomously.
•Fragments/replicas allocated to sites. •Each DBMS participates in at
•Sites linked by a communication network. least one global application.
Why need distributed DB

o Organizational and economic reason.


o Interconnection of existing database.
o Incremental growth
o Reduced communication overhead.
o Performance considerations.
o Reliability and availability.
A reference architecture of
DDB
A reference architecture consists of:
●global schema.
●fragmentation schema.
●allocation schema.
●local mapping schema.
Reference Architecture for DDB
●●global schema: defines all the data which are
contained in distributed database.
●fragment: each global relation can be split
into several non overlapping portion.
●●fragmentation schema: the mapping
between global relation and fragment.
●●allocation schema: define at which site a
fragment located.
●●local mapping schema: depends on the type of
DBMS .
The Fundamental Principle of
Distributed Database

“To the user, a distributed system should


look exactly like a non distributed system.”

Fundamental Principle: make distribution transparent to user.


The fact that fragments are stored on different computers is hidden
from the users
What is the 12 objectives?
 Local autonomy  Distributed query
 No reliance on a central processing
site  Distributed transaction
 Continuous operation management
 Location independence  Hardware independence
 Fragmentation  Operating system
independence independence
 Replication independence  Network independence
 DBMS independence
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.
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.
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.
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.
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.
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
An example of fragmentation
 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’)
EMP# DEPT# SALARY
User perception
E1 D1 40K

EMP E2 D1 42K
E3 D2 30K
E4 D2 35K
E5 D3 48K

New York
EMP# DEPT# SALARY Shanghai EMP# DEPT# SALARY
N_EMP E1 D1 40K
E3 D2 30K
S_EMP
E2 D1 42K
E4 D2 45K
E5 D3 48K
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
An example of replication
 REPLICATE N_EMP AS
SN_EMP AT SITE ‘Shanghai’;
REPLICATE S_EMP AS
NS_EMP AT SITE ‘New York’;
New York Shanghai

EMP# DEPT# SALARY EMP# DEPT# SALARY

N_EMP E1 S_EMP E3 D2 30K


D1 40K
E2 D1 42K E4 D2 35K

E5 D3 48K

SN_EMP EMP# DEPT# SALARY


NS_EMP EMP# DEPT# SALARY
E1 D1 40K
E3 D2 30K (N_EMP
(S_EMP E2 D1 42K
E4 D2 35K Replica)
Replica) E5 D3 48K
Objective 7
Distributed Query Processing
 A relational distributed system is likely to
outperform a non relational one by orders
of magnitude.
 The query that involves several sites,
there will be many possible ways of
moving data around the system.
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 = (6.67minutes)
2. Move suppliers and shipments to site B and process the query at B.
T2 = (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 second approx.
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.
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.
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.
Objective 11
Network Indepence
 Desirable to be able to support a variety
of disparate communication networks also.
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.
A hypothetical Ingres–provided gateway to Oracle:

Ingres Oracle
GATEWAY
(SQL) (SQL)

Ingres Distributed Ingres database Oracle


Ingres user
database database

Site X Site Y
Types of distributed database

Homogeneous DB Heterogeneous DB
♦ all sites use the same ♦ sites may run different
DBMS sites. DBMS product.
♦ approach provides ♦ occur when sites have
incremental growth and implemented their own
allows increased database.
performance.
Homogeneous Database

Identical DBMSs

Source: adapted from Bell and Grimson, 1992.


Heterogeneous Database

Non-identical DBMSs

Source: adapted from Bell and Grimson, 1992.


12.3 Introduction

Why use a DDBMS? (!)


Advantages: Disadvantages:
•Reflects organizational structure •Complexity
•Improved shareability and •Cost

local autonomy •Security


•Improved availability •Integrity control more difficult
•Improved reliability •Lack of standards
•Improved performance •Lack of experience
•Economics •Database design more complex
•Modular growth
Functions of a DDBMS
• Expect DDBMS to have at least the functionality of a DBMS.

Also to have following functionality:


• Extended communication services.
• Extended Data Dictionary.
• Distributed query processing.
• Extended concurrency control.
• Extended recovery services.
Advantages & disadvantages of
DDB
Advantages: Disadvantages:
●increased reliability ●software cost &
availability. complexity.
●capacity and growth. ●slow response.
●efficient & flexibility. ●security.
●distributed database ●integrity
sharing.
12.6 Distributed Relational Database Design

Transparency in a DDBMS
Transparency hides implementation details from users.

Overall objective: equivalence to user of DDBMs to centralised DBMS


- FULL transparency not universally accepted objective

Four main types:


1. Distribution transparency
2. Transaction transparency
3. Performance transparency
4. DBMS transparency (only applicable to heterogeneous)
1. Distribution Transparency
Distribution transparency: allows user to perceive database as
single, logical entity.

If DDBMS exhibits distribution transparency, user does not need to know:


• fragmentation transparency: data is fragmented
• Location transparency: location of data items
• otherwise call this local mapping transparency
• replication transparency: user unaware of replication of fragments

Naming transparency: each item in a DDB must have a unique name.


-One solution: create central name server - loss of some local autonomy.
- central site may become a bottleneck. - low availability: if the central site fails.
Alternative solution: prefix object with identifier of creator site, each
fragment and its copies. Then each site uses alias.
12.6 Distributed Relational Database Design

2. Transaction Transparency
Transaction transparency: Ensures all distributed Ts maintain distributed
database’s integrity and consistency.

• Distributed T accesses data stored at more than one location.


• Each T is divided into no. of subTs or agents, one for each site that has to be
accessed.
• DDBMS must ensure the indivisibility of both the global T and each of the
subTs.
12.6 Distributed Relational Database Design

2. Transaction Transparency

Concurrency transparency: All Ts must execute independently and be


logically consistent with results obtained if Ts executed in some arbitrary
serial order.
• Replication makes concurrency more complex
Failure transparency: must ensure atomicity and durability of global T.
• Means ensuring that subTs of global T either all commit or all abort.
12.6 Distributed Relational Database Design

3. Performance Transparency
DDBMS: - no performance degradation due to distributed architecture.
- determine most cost-effective strategy to execute a request.

Distributed Query Processor (DQP) maps data request into ordered


sequence of operations on local databases.
- Must consider fragmentation, replication, and allocation schemas.
DQP has to decide:
1. which fragment to access
2. which copy of a fragment to use
3. which location to use.
- produces execution strategy optimized with respect to some cost function.
Typically, costs associated with a distributed request include: I/O cost;
CPU cost, communication cost.
Thank you!

You might also like