chapter 17

59
Chapter 17 Chapter 17 Client-Server Processing and Distributed Databases

Upload: oren

Post on 05-Jan-2016

40 views

Category:

Documents


0 download

DESCRIPTION

Chapter 17. Client-Server Processing and Distributed Databases. Outline. Overview of Distributed Processing and Distributed Data Client-Server Database Architectures Web Database Connectivity Architectures for Distributed Database Management Systems - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Chapter 17

Chapter 17Chapter 17

Client-Server Processing and Distributed Databases

Page 2: Chapter 17

OutlineOutline

Overview of Distributed Processing and Distributed Data

Client-Server Database Architectures Web Database Connectivity Architectures for Distributed Database

Management Systems Transparency for Distributed Database

Processing Distributed Database Processing

Page 3: Chapter 17

Evolution of Distributed Evolution of Distributed Processing and Distributed DataProcessing and Distributed Data

Need to share resources across a networkTimesharing (1970s)Remote procedure calls (1980s)Client-server computing (1990s)

Page 4: Chapter 17

Timesharing NetworkTimesharing Network

Database

Terminal

Terminal

Terminal

Mainframe computer

Page 5: Chapter 17

Resource Sharing with a Resource Sharing with a Network of Personal ComputersNetwork of Personal Computers

Database

(a) Remote procedural call

(b) File sharing

Database

Procedural call

Return results

File request

File returned

Page 6: Chapter 17

Client-Server Processing with Client-Server Processing with Distributed processing onlyDistributed processing only

Database

Client

Client

Client

Server

Page 7: Chapter 17

Distributed processing and dataDistributed processing and data

DatabaseDatabase

Client

Client

Client

Client

Server Server

Page 8: Chapter 17

Motivation for Distributed Motivation for Distributed ProcessingProcessing Flexibility: the ease of maintaining and

adapting a systemScalability: the ability to support scalable

growth of hardware and software capacity Interoperability: open standards that allow

two or more systems to exchange and use software and data

Page 9: Chapter 17

Motivation for Distributed DataMotivation for Distributed Data

Data control: locate data to match an organization’s structure

Communication costs: locate data close to data usage to lower communication cost and improve performance

Reliability: increase data availability by replicating data at more than one site

Page 10: Chapter 17

Summary of Distributed Summary of Distributed Processing and DataProcessing and Data

Distributed Processing

Distributed Data

Advantages Flexibility, interoperability, scalability

Local control of data, improved performance, reduced communication costs, improved reliability

Disadvantages High complexity, high development cost, possible interoperability problems

High complexity, additional security concerns

Page 11: Chapter 17

Client-Server Database Client-Server Database ArchitecturesArchitectures Client-Server Architecture is an

arrangement of components (clients and servers) among computers connected by a network.

A client-server architecture supports efficient processing of messages (requests for service) between clients and servers.

Page 12: Chapter 17

Design IssuesDesign Issues

Division of processing: the allocation of tasks to clients and servers.

Process management: interoperability among clients and servers and efficiently processing messages between clients and servers.

• Middleware: software for process management

Page 13: Chapter 17

Tasks to DistributeTasks to Distribute Presentation: code to maintain the

graphical user interfaceValidation: code to ensure the consistency

of the database and user inputs Business logic: code to perform business

functionsWorkflow: code to ensure completion of

business processesData access: code to extract data to answer

queries and modify a database

Page 14: Chapter 17

MiddlewareMiddleware

A software component that performs process management.

Allow clients and servers to exist on different platforms.

Allows servers to efficiently process messages from a large number of clients.

Often located on a dedicated computer.

Page 15: Chapter 17

Client-Server Computing with Client-Server Computing with MiddlewareMiddleware

Middleware

Page 16: Chapter 17

Types of MiddlewareTypes of Middleware

Transaction-processing monitors: relieve the operating system of managing database processes

Message-oriented middleware: maintain a queue of messages

Object-request brokers: provide a high level of interoperability and message intelligence

Data access middleware: provide a uniform interface to relational and non relational data using SQL

Page 17: Chapter 17

Two-Tier ArchitectureTwo-Tier Architecture

Database

SQL statements

Query results

Database server

Page 18: Chapter 17

Two-Tier Client-Server Two-Tier Client-Server ArchitectureArchitecture

A PC client and a database server interact directly to request and transfer data.

The PC client contains the user interface code.

The server contains the data access logic. The PC client and the server share the

validation and business logic.

Page 19: Chapter 17

Three-Tier Architecture Three-Tier Architecture (Middleware Server)(Middleware Server)

Database

SQL statements

Query Results

Middleware server Database server

Page 20: Chapter 17

Three-Tier Architecture Three-Tier Architecture (Application Server)(Application Server)

(b) Application serverDatabase

SQL statements

Query results

Database server Application server

Page 21: Chapter 17

Three-Tier ArchitectureThree-Tier Architecture

To improve performance, the three-tier architecture adds another server layer either by a middleware server or an application server.

• The additional server software can reside on a separate computer.

• Alternatively, the additional server software can be distributed between the database server and PC clients.

Page 22: Chapter 17

Multiple-Tier ArchitectureMultiple-Tier Architecture

A client-server architecture with more than three layers: a PC client, a backend database server, an intervening middleware server, and application servers.

Provides more flexibility on division of processing

The application servers perform business logic and manage specialized kinds of data such as images.

Page 23: Chapter 17

Multiple-Tier ArchitectureMultiple-Tier Architecture

Database

Application server

Application server

Middleware server Database server

Page 24: Chapter 17

Multiple-Tier Architecture with Multiple-Tier Architecture with Software BusSoftware Bus

Database

Software bus

Application server Database server Application server

Page 25: Chapter 17

Web Database ConnectivityWeb Database Connectivity

Internet commerce depends heavily on database access for websites.

Web database connectivity allows a database to be manipulated through a Web page.

A user may use a Web form to change a database or view a report generated from a database.

Page 26: Chapter 17

Internet BasicsInternet Basics

Network of networksUses standard protocols: TCP/IP

– TCP: splits messages into packets– IP: routes messages

Each computer on the Internet has a unique numeric address known as an IP address.

Page 27: Chapter 17

Internet and Intranet RelationshipInternet and Intranet Relationship

Firewall

TCP/IP

TCP/IPTCP/IP

TCP/IP

TCP/IP TCP/IP

Intranet

Internet

Page 28: Chapter 17

World Wide WebWorld Wide Web

Most popular application on the InternetSupports browsing pages located on any

computer on the InternetHypertext Transport Protocol (HTTP)

establishes a session between a browser and a Web server.

Each page has a unique address known as a URL.

Page 29: Chapter 17

Web Page Request CycleWeb Page Request Cycle

User clicks hyperlink.

Web server locatespage.

1

3

Web server sends file.

Browser sends request toweb server.

2

4

Browser displays file.5

Page 30: Chapter 17

XML/XSLXML/XSL

Solutions to HTML limitationseXtensible Markup Language (XML)

– Separates content and structure of a document– Use document type declaration or schema to

specify document structureeXtensible Style Language (XSL):

supports transformation into display languages

Both are extensible languages

Page 31: Chapter 17

The Common Gateway The Common Gateway Interface (CGI)Interface (CGI)CGI is an interface that allows a Web

server to invoke an external program on the same computer.

The external program uses the parameters passed by the Web server to produce output that is sent back to the browser.

Usually, the output contains HTML/XML so that the browser can display it properly.

Page 32: Chapter 17

Straight CGIStraight CGI

Web serverDatabase

serverExternalprogram

Parameters SQL

HTML/XML Results

Database

Page 33: Chapter 17

Hybrid CGIHybrid CGI

Web serverPartnerprogram

Externalprogram

Parameters SQL

Results

Databaseserver

Parameters

Database

HTML/XML HTML/XML

Page 34: Chapter 17

Server-side connectivity Server-side connectivity Server-side connectivity bypasses the

external program needed with the CGI approaches.

Specialized Web server or middleware server is needed

SQL statements and database logic are kept in a web page or external file.

The database code can execute stored procedures on the database server.

Page 35: Chapter 17

Server-Side Connectivity Server-Side Connectivity ApproachApproach

Web serverwith

middlewareextension

Databaseserver

SQL

HTML/XML

SQL statementsand formatting requirements

Database

Page 36: Chapter 17

Server-Side Connectivity with a Server-Side Connectivity with a Middleware ServerMiddleware Server

Web serverMiddleware

serverwith listener

SQL

Results

SQL statementsand formatting requirements

Database

Databaseserver

Databaserequest

HTML/XML

Page 37: Chapter 17

Client-Side ConnectivityClient-Side Connectivity

Client computing capacity can be more fully utilized without storing code on the client.

Provides a more customized interface than permitted by HTML

Supports data buffering by the client to improve performance

Page 38: Chapter 17

Web Page Request Cycle with Web Page Request Cycle with Client-Side ConnectivityClient-Side Connectivity

Web server sends filecontaining HTML/XMLand embedded applet(Java) or binary object(ActiveX).

Browser sends request toweb server.

Page 39: Chapter 17

Summary of Web ConnectivitySummary of Web ConnectivityApproach Architecture Example Product Comments

Straight CGI Two-tier Apache Web server with external PERL program

Inexpensive; portability only limited by external program; limited scalability

Hybrid CGI Two-tier Apache Web server with Cold Fusion server extensions

More expensive than straight CGI; portability depends on partner program; scalable to modest loads

Server-side connectivity

Three-tier and multiple-tier

Internet Information Server with Microsoft Transaction Server

Expensive; Web server dependent; highly scalable

Server-side connectivity (Middleware)

Three-tier and multiple-tier

Oracle Application Server

Expensive; Web server independent; highly scalable

Client-side connectivity

Two- and multiple-tier

Microsoft Remote Data Service

Customized client interface; efficient data buffering; usually works with server-side connectivity approaches

Page 40: Chapter 17

Architectures for Distributed Architectures for Distributed Database Management Systems Database Management Systems

DBMSs need fundamental extensions.Underlying the extensions are a different

component architecture and a different schema architecture.

Component Architecture manages distributed database requests.

Schema Architecture provides additional layers of data description.

Page 41: Chapter 17

Global RequestsGlobal Requests

Customer-order data

Product data

Customer-order data

Product data

Page 42: Chapter 17

Component ArchitectureComponent Architecture

DB

Site 1DDM

LDM

DDM

DDM

LDM

DB

GD

GD

Site 2

Site 3

GD

Page 43: Chapter 17

Schema Architecture ISchema Architecture IExternal

schema 1External

schema 2External

schema n...

Conceptualschema

Fragmentationschema

Allocationschema

Internalschema 1

Internalschema 2

Internalschema m...

m Sites

Page 44: Chapter 17

Schema Architecture IISchema Architecture II Global

externalschema 1

Globalexternal

schema 2

Globalexternal

schema n...

Globalconceptual

schema

Site 1 localmappingschema

Site 1 localschemas

(conceptual,internal,external) ...

m Sites

Site 2 localschemas

(conceptual,internal,external)

Site m localschemas

(conceptual,internal,external)

Site 2 localmappingschema

Site m localmappingschema

...

Page 45: Chapter 17

Transparency for Distributed Transparency for Distributed Database ProcessingDatabase Processing Transparency is related to data independence. With transparency, users can write queries

with no knowledge of the distribution, and distribution changes will not cause changes to existing queries and transactions.

Without transparency, users must reference some distribution details in queries and distribution changes can lead to changes in existing queries.

Page 46: Chapter 17

Motivating ExampleMotivating Example

CustNameCustCityCustStateCustZipCustRegion

CustNo

Customer

OrdDateOrdAmtCustNo

OrdNo

Order

OrdCity

ProdNoOrdNo

OrderLine

ProdNameProdColorProdPrice

ProdNo

Product

QOHWarehouseNoProdNo

StockNo

Inventory1

11

1

8

8

8 8

Page 47: Chapter 17

Fragments Based on the Fragments Based on the CustRegionCustRegion Field Field

CREATE FRAGMENT Western-Customers AS SELECT * FROM Customer WHERE CustRegion = 'West'

CREATE FRAGMENT Western-Orders AS SELECT Order.* FROM Order, Customer WHERE Order.CustNo = Customer.CustNo AND CustRegion = 'West'

CREATE FRAGMENT Western-OrderLines AS SELECT OrderLine.* FROM Customer, OrderLine, Order WHERE OrderLine.OrdNo = Order.OrdNo AND Order.CustNo = Customer.CustNo AND CustRegion = 'West'

CREATE FRAGMENT Eastern-Customers AS SELECT * FROM Customer WHERE CustRegion = 'East'

CREATE FRAGMENT Eastern-Orders AS SELECT Order.* FROM Order, Customer WHERE Order.CustNo = Customer.CustNo AND CustRegion = 'East'

CREATE FRAGMENT Eastern-OrderLines AS SELECT OrderLine.* FROM Customer, OrderLine, Order WHERE OrderLine.OrdNo = Order.OrdNo AND Order.CustNo = Customer.CustNo AND CustRegion = 'East'

Page 48: Chapter 17

Fragments Based on the Fragments Based on the WareHouseNoWareHouseNo Field Field

CREATE FRAGMENT Denver-Inventory AS SELECT * FROM Inventory WHERE WareHouseNo = 1

CREATE FRAGMENT Seattle-Inventory AS SELECT * FROM Inventory WHERE WareHouseNo = 2

Page 49: Chapter 17

Fragmentation TransparencyFragmentation Transparency

Fragmentation transparency provides the highest level of data independence.

Users formulate queries and transactions without knowledge of fragments (locations, or local formats).

If fragments change, queries and transactions are not affected.

Page 50: Chapter 17

Location TransparencyLocation Transparency

Location transparency provides a lesser level of data independence than fragmentation transparency.

Users need to reference fragments in formulating queries and transactions.

However, knowledge of locations and local formats is not necessary.

Page 51: Chapter 17

Local Mapping TransparencyLocal Mapping Transparency

Local mapping transparency provides a lesser level of data independence than location transparency.

Users need to reference fragments at sites in formulating queries and transactions.

However, knowledge of local formats is not necessary.

Page 52: Chapter 17

Distributed Database Distributed Database ProcessingProcessing Distributed data adds considerable

complexity to query processing and transaction processing.

Distributed database processing involves movement of data, remote processing, and site coordination.

Performance implications sometimes cannot be hidden.

Page 53: Chapter 17

Distributed query processingDistributed query processing

Involves both local (intra site) and global (inter site) optimization.

Multiple optimization objectivesThe weighting of communication costs

versus local processing costs depends on network characteristics.

There are many more possible access plans for a distributed query.

Page 54: Chapter 17

Distributed Transaction Distributed Transaction ProcessingProcessing Distributed DBMS provides concurrency

and recovery transparency. Independently operating sites must be

coordinated. New kinds of failures exist because of the

communication network.New protocols are necessary.

Page 55: Chapter 17

Distributed Concurrency ControlDistributed Concurrency Control The simplest scheme involves centralized

coordination.Centralized coordination involves the

fewest messages and the simplest deadlock detection.

The number of messages can be twice as much in distributed coordination.

Primary Copy Protocol is used to reduce overhead with locking multiple copies.

Page 56: Chapter 17

Centralized CoordinationCentralized Coordination

Centralcoordinator

Subtransaction 1at Site x

......Subtransaction 2at Site y

Subtransaction nat Site z

Lockrequest

Lockstatus

Page 57: Chapter 17

Distributed Recovery Distributed Recovery ManagementManagement Distributed DBMSs must contend with

failures of communication links and sites.Detecting failures involves coordination

among sites. The recovery manager must ensure that

different parts of a partitioned network act in unison.

The protocol for distributed recovery is the two phase commit protocol (2PC).

Page 58: Chapter 17

Voting and Decision PhasesVoting and Decision Phases

Voting phase

Coordinator Participant

Write Begin-Commit to log.Send Ready messages.Wait for responses.

Force updates to disk.If no failure, Write Ready-Commit to log. Send Ready vote.Else send Abort vote.

If all sites vote ready before timeout, Write Global Commit record. Send Commit messages. Wait for Acknowledgments.Else send Abort messages.

Decision phase

Write Commit to log.Release locks.Send acknowledgment.

Wait for acknowledgments.Resend Commit messages if necessary.Write global end of transaction.

1

2

3

4

5

Page 59: Chapter 17

SummarySummary

Utilizing distributed processing and data can significantly improve DBMS services but at the cost of new design challenges.

Several client-server architectures provide alternatives among cost, complexity, and benefit levels.

Architectures for distributed DBMSs differ in the integration of the local databases and level of data independence.