comp 5138 relational database management systems semester 2, 2007 lecture 8 database system...
TRANSCRIPT
COMP 5138COMP 5138
Relational Database Relational Database
Management Systems Management Systems
Semester 2, 2007Semester 2, 2007
Lecture 8Lecture 8
Database System ArchitecturesDatabase System Architectures
2222
L8L8DB System DB System
ArchitecturesArchitectures
Database System ArchitecturesCentralized systems Client-Server systemsThree-tier systems
Presentation layer technologiesApplication layer technologies
Today’s Agenda
3333
L8L8DB System DB System
ArchitecturesArchitectures
Three types of functionality:
The system architecture determines whether these three components reside on a single system (1-tier) or whether they are distributed across several tiers
Presentation Services- Input – keyboard/mouse- Output – monitor/printer
Application Services- Business rules - I/O processing
Data Management(Storage Logic)
- data storage and retrieval
GUI Interface
Procedures, functions,programs
DBMS activities
Data-intensive Systems
4444
L8L8DB System DB System
ArchitecturesArchitectures Single-User System
Presentation Services - displays forms, handles flow of information to/from screenApplication Services - implements user request, interacts with DBMSTransactional properties automatic (isolation is trivial) or not required (this is not really an enterprise)DBMS runs within the user processExamples: Access or Berkeley DB
presentation application
services services DBMS
user module
centralized system
5555
L8L8DB System DB System
ArchitecturesArchitecturesCentralized Multi-User System
Dumb terminals connected to mainframeApplication and presentation services on mainframe
ACID properties requiredAtomicity - Consistency - Isolation - DurabilityIsolation: DBMS sees an interleaved scheduleAtomicity and durability: system supports a major enterprise
Transaction abstraction, implemented by DBMS, provides ACID properties
More details on implementing transactions in week 11
6666
L8L8DB System DB System
ArchitecturesArchitecturesCentralized Multi-User System
user module
central machine
presentation applicationservices services
presentation applicationservices services
• •
•
communication
DBMS
dumb terminal
7777
L8L8DB System DB System
ArchitecturesArchitectures Evaluation
All functionality combined into a single tierCentralised system: runs on a single computer system and does not interact with other computer systems System resources must be used for both DBMS and application logicUsually: mainframe, but also PC
Benefit:Easy maintenance and central administration
Drawback:Bad scalability for larger number of usersTypically only dumb terminals as a user interface
8888
L8L8DB System DB System
ArchitecturesArchitecturesTwo-Tier Architectures:
Client-ServerFunctionality divided between client and server
typically separated by a network
Server systems satisfy requests of m client systems
9999
L8L8DB System DB System
ArchitecturesArchitecturesFront-End versus Back-End
Database functionality can be divided into:Back-end: manages access structures, query evaluation and optimization, concurrency control and recovery.Front-end: consists of tools such as forms, report-writers, and graphical user interface facilities.
The interface between the front-end and the back-end is through SQL or through an application program interface.
SQL user-interface
formsinterface
reportwriter
graphicalinterfacefront-end
interface(SQL ; API)
SQLengine
back-end
10101010
L8L8DB System DB System
ArchitecturesArchitectures Thin versus Thick Client
Database applications: data management + application logic + presentationWork division: Thin client
Client responsible for presentation (typically GUI)Server: business logic and data management
Work division: Thick clientClient implements both user interface and business logicServer: data management only
ApplicationLogic
DataPresentation
Client
DataManagement
Server
? ?
11111111
L8L8DB System DB System
ArchitecturesArchitecturesC/S Architecture “Zoom-In”
Client and server are completely separated2 separated processes / systems
Communication between client & server via networkUsage of a special protocol, e.g. JDBC, Net8 (Oracle)
DB ServerLibrary
OperatingSystem
DB Server
ProcessDB Client
Library / Driver
OperatingSystem
ClientProcess
Network
ServerClient
12121212
L8L8DB System DB System
ArchitecturesArchitectures DB Server Internals
DB Server
Monolithic Server
single DB process
Multiple Server
multiple DB processes
Symmetric
per AP one DB process
Asymmetric
dynamic assignment of
APs to DB processes
13131313
L8L8DB System DB System
ArchitecturesArchitectures Monolithic Server
Exactly one server process for all clients (“One-to-many”)DBMS server process typically prioritised by operating systemServer uses multi-threadingServer does own resource management
Examples: Sybase, MS SQL Server
APClient
iDBMSServer
operating system 1
APClient
1
CLCL
APClient
k
CL
operating system n
network
…
14141414
L8L8DB System DB System
ArchitecturesArchitectures Multiple Server
DBMS consists of several processesScheduling done by the operating system
Communication betweenserver processes: via shared memoryclients and servers: via operating system or network
Two variants:Symmetric - each client is mapped to exactly one server process: static mapping with a certain number of n servers pre-generated maximal degree of parallelism is nAsymmetric - a dispatcher connects a client to a server process. Again, a certain number of servers are instantiated beforehand, but degree of parallelism can be higher
Examples: Oracle, Informix, DB2
15151515
L8L8DB System DB System
ArchitecturesArchitectures Asymmetric Multiple Server
DBMSServer
k
APClient
iDBMSServer
1
Operating system 1
APClient
1
CLCL
APClient
m
CL
Operating system n
network
……
Disp
atch
er
sharedmem
16161616
L8L8DB System DB System
ArchitecturesArchitectures Oracle Server Architecture
17171717
L8L8DB System DB System
ArchitecturesArchitectures Oracle Server Configurations
18181818
L8L8DB System DB System
ArchitecturesArchitecturesOracle Client-Server
Connections
19191919
L8L8DB System DB System
ArchitecturesArchitectures Comparison
Thick ClientsMakes good use of resources on desktop machines which are often lightly loaded
Allows server machine to concentrate on disk transfers etc
More responsiveSome responses don’t need to cross the network Eg data validation
done in clientMay scale better
Perhaps smaller and fewer data transfers between client and server (if many different presentations are needed of the same data)
Thin clientsServer doesn’t need to trust clients
No threat to data integrity from malicious client
Less complex administration and maintenance
Eg no need to deploy upgrades or patches to application logic?
May scale betterPerhaps smaller and fewer data transfers between client and server (if results of database queries are further reduced and filtered in application layer, to just what user needs)
The best design varies according to technology changes
20202020
L8L8DB System DB System
ArchitecturesArchitectures Three-Tier Architectures
Client Program
Web / Application Server
Database System
Presentation Tier
Middle Tier
Data ManagementTier
• primary interface to the user (e.g. web browser)• needs to adapt to different display devices (PC, PDA, ...)
• implements business logic and workflow• may access several different DBMSs
• one or more standard database management systems
21212121
L8L8DB System DB System
ArchitecturesArchitectures Three-Tiered Model of TPS
DBMS
database servermachine
present.server
• •
•
client machines
communication
present.server
applic.server
applic. servermachines
trans.server
trans. servermachines
typically clustered
22222222
L8L8DB System DB System
ArchitecturesArchitecturesInterconnection/Clustering of Servers in Three-Tiered Model
presentationserver
presentationserver
presentationserver
presentationserver
applicationserver
applicationserver
transactionserver
transactionserver
databaseserver
databaseserver
••
• • • •
• • •
23232323
L8L8DB System DB System
ArchitecturesArchitectures E-Commerce as Example
Web Server(dynamic web pages such as CGI or JSP)
JDBC or
ODBC
Web Browser
http
Database System
network
Web browser is clientApplication logic in dynamic web pages
Servlets or “Java Server Pages” (JSP): Java code that runs in web serverNon-Java world: ASP, PHP, CGI, …
Database access from servlets / JSPs via JDBC
24242424
L8L8DB System DB System
ArchitecturesArchitecturesMore complicated example
Web Browser
Web Server(servlets; JSP)
Database System
network
Application Server
http
EJBEJB EJB
EJB
JDBC ODBC
RMI
Dynamic web pages mostly presentation
Again servlets or JSPs
Application ServerContainer for application logice.g. Enterprise Java Beans (EJB)Resource mgmt. (e.g. db connections)
Database systemis accessed from application serverusing JDBC or ODBC
25252525
L8L8DB System DB System
ArchitecturesArchitectures
Example 1: Course Enrolment System
Build a system in which students can enroll in coursesClient Program
Log in different users (students, staff, faculty), display forms and human-readable output
Web ServerLogic to add a course, drop a course, create a new course, etc.
Database SystemStudent info, course info, instructor info, course availability, pre-requisites, etc.
Browser
Web Server
Database(s)
Server
Server
Client
Client
26262626
L8L8DB System DB System
ArchitecturesArchitectures Example 2: Internet Shop
Web Browser: GUI, navigation, presentation, simple input checks
WWW Server:Log in different users, session management, display forms etc.
Application Server:Logic for placing orders, purchasing, order status checks, etc.
Databaseitem infos, customer data, orders, …
Browser
Web Server
Database(s)
Server
Server
Client
Client
Application Server
Server
Client
27272727
L8L8DB System DB System
ArchitecturesArchitecturesTechnologies for the Three
Tiers
Client Program(Web Browser)
Application Logic(Web Server;
Application Server)
Data Management(Database System)
HTMLJavaScript
Servlets; JSP; ASPJ2EE; EJB; .NET
SQL, XMLStored Procedures
HTTP
JDBC; SQLJ; OLEDB
28282828
L8L8DB System DB System
ArchitecturesArchitecturesAdvantages of Three-Tier
Architectures
Heterogeneous SystemsTiers can be independently maintained, modified, and replaced
Thin ClientsOnly presentation layer at clients (web browser)
Integrated data accessSeveral database systems can be handled transparently at the middle tierCentral management of connections
ScalabilityReplication at middle tier allows scalability of business logic
Software developmentCode for business logic is centralisedInteraction between tiers through well-defined APIs:One can reuse standard components at each tier
29292929
L8L8DB System DB System
ArchitecturesArchitectures Review Question
What kind of system architecture has Oracle’s iSQL*Plus, which we are using in the labs?
A. 1-Tier (centralized)B. 2-Tier (Client/Server)C. 3-Tier
30303030
L8L8DB System DB System
ArchitecturesArchitectures
Database System ArchitecturesPresentation layer technologies
HTML, JavascriptApplication layer technologies
Today’s Agenda
31313131
L8L8DB System DB System
ArchitecturesArchitecturesOverview of the Presentation
Tier
Recall: Functionality of the presentation tierPrimary interface to the userNeeds to adapt to different display devices (PC, PDA, cell phone, voice access?)Simple functionality, such as field validity checking
We will cover:HTML Forms: How to pass data to the middle tierJavaScript: Simple functionality at the presentation tier
32323232
L8L8DB System DB System
ArchitecturesArchitectures HTML Forms
Common way to communicate data from client to middle tierGeneral format of a form:
<FORM ACTION=“page.jsp” METHOD=“GET”NAME=“LoginForm”>
…</FORM>
Components of an HTML FORM tag:ACTION: Specifies URI that handles the contentMETHOD: Specifies HTTP GET or POST methodNAME: Name of the form; can be used in client-side scripts to refer to the form
33333333
L8L8DB System DB System
ArchitecturesArchitectures Inside HTML Forms
INPUT tagAttributes:
TYPE: text (text input field), password (text input field where input is, reset (resets all input fields)NAME: symbolic name, used to identify field value at the middle tierVALUE: default value
Example: <INPUT TYPE=“text” Name=“title”>
Example form:<form method="POST" action="TableOfContents.jsp">
<input type="text" name="userid"><input type="password" name="password"><input type="submit" value="Login“ name="submit"><input type=“reset” value=“Clear”>
</form>
34343434
L8L8DB System DB System
ArchitecturesArchitectures Passing Arguments
Two methods: GET and POSTGET
Form contents go into the submitted URIStructure:action?name1=value1&name2=value2&name3=value3
Action: name of the URI specified in the form(name,value)-pairs come from INPUT fields in the form; empty fields have empty values (“name=“)
Example from previous password form:TableOfContents.jsp?userid=john&password=johnpwNote that the page named action needs to be a program, script, or page that will process the user input
35353535
L8L8DB System DB System
ArchitecturesArchitecturesHTTP GET: Encoding Form Fields
Form fields can contain general ASCII characters that cannot appear in an URIA special encoding convention converts such field values into “URI-compatible” characters:
Convert all “special” characters to %xyz, were xyz is the ASCII code of the character. Special characters include &, =, +, %, etc.Convert all spaces to the “+” characterGlue (name,value)-pairs from the form INPUT tags together with “&” to form the URI
36363636
L8L8DB System DB System
ArchitecturesArchitecturesHTML Forms: A Complete
Example
<form method="POST" action="TableOfContents.jsp"><table align = "center" border="0" width="300"><tr>
<td>Userid</td><td><input type="text" name="userid" size="20"></td>
</tr><tr>
<td>Password</td><td><input type="password" name="password" size="20"></td>
</tr><tr>
<td align = "center"><input type="submit" value="Login“name="submit"></td>
</tr></table>
</form>
37373737
L8L8DB System DB System
ArchitecturesArchitectures JavaScript
Goal: Add functionality to the presentation tier.Sample applications:
Detect browser type and load browser-specific pageForm validation: Validate form input fieldsBrowser control: Open new windows, close existing windows (example: pop-up ads)
Usually embedded directly inside the HTML with the <SCRIPT> … </SCRIPT> tag.<SCRIPT> tag has several attributes:
LANGUAGE: specifies language of the script (such as javascript)SRC: external file with script codeExample:<SCRIPT LANGUAGE=“JavaScript” SRC=“validate.js></SCRIPT>
38383838
L8L8DB System DB System
ArchitecturesArchitectures JavaScript (Contd.)
If <SCRIPT> tag does not have a SRC attribute, then the JavaScript is directly in the HTML file.Example:<SCRIPT LANGUAGE=“JavaScript”><!-- alert(“Welcome to our bookstore”)//--></SCRIPT>Two different commenting styles
<!-- comment for HTML, since the following JavaScript code should be ignored by the HTML processor// comment for JavaScript in order to end the HTML comment
39393939
L8L8DB System DB System
ArchitecturesArchitectures JavaScript (Contd.)
JavaScript is a complete scripting languageVariablesAssignments (=, +=, …)Comparison operators (<,>,…), boolean operators (&&, ||, !)Statements
if (condition) {statements;} else {statements;}for loops, do-while loops, and while-loops
Functions with return valuesCreate functions using the function keywordf(arg1, …, argk) {statements;}
40404040
L8L8DB System DB System
ArchitecturesArchitecturesJavaScript: A Complete Example
HTML Form:
<form method="POST“ action="TableOfContents.jsp"> <input type="text" name="userid"> <input type="password"
name="password"> <input type="submit" value="Login“
name="submit"> <input type=“reset” value=“Clear”></form>
Associated JavaScript:
<script language="javascript">function testLoginEmpty(){ loginForm = document.LoginForm if ((loginForm.userid.value == "") || (loginForm.password.value == "")) { alert('Please enter values for userid and
password.'); return false; } else return true;}</script>
45454545
L8L8DB System DB System
ArchitecturesArchitectures
Database System ArchitecturesPresentation layer technologiesApplication layer technologies
CGI, application servers, Servlets, JavaServerPages, maintaining state
Today’s Agenda
46464646
L8L8DB System DB System
ArchitecturesArchitectures Overview of the Middle Tier
Recall: Functionality of the middle tierEncodes business logicConnects to database system(s)Accepts form input from the presentation tierGenerates output for the presentation tier
We will coverCGI: Protocol for passing arguments to programs running at the middle tierApplication servers: Runtime environment at the middle tierServlets: Java programs at the middle tierJavaServerPages: Java scripts at the middle tierMaintaining state: How to maintain state at the middle tier. Main focus: Cookies.
47474747
L8L8DB System DB System
ArchitecturesArchitecturesCGI: Common Gateway Interface
Goal: Transmit arguments from HTML forms to application programs running at the middle tierDetails of the actual CGI protocol unimportant à libraries implement high-level interfaces
Disadvantages:The application program is invoked in a new process at every invocation (remedy: FastCGI)No resource sharing between application programs (e.g., database connections)Remedy: Application servers
48484848
L8L8DB System DB System
ArchitecturesArchitectures CGI: Example
HTML form:<form action=“findbooks.cgi” method=POST>Type an author name:<input type=“text” name=“authorName”><input type=“submit” value=“Send it”><input type=“reset” value=“Clear form”></form>
Perl code:use CGI;$dataIn=new CGI;$dataIn->header();$authorName=$dataIn->param(‘authorName’);print(“<HTML><TITLE>Argument passing test</TITLE>”);print(“The author name is “ + $authorName);print(“</HTML>”);exit;
49494949
L8L8DB System DB System
ArchitecturesArchitectures Application Servers
Idea: Avoid the overhead of CGIMain pool of threads of processesManage connectionsEnable access to heterogeneous data sourcesOther functionality such as APIs for session management
50505050
L8L8DB System DB System
ArchitecturesArchitecturesApplication Server: Process
Structure
Process Structure
Web Browser Web Server
Application Server
C++ Application
JavaBeans
DBMS 1
DBMS 2
Pool of Servlets
HTTP
JDBC
ODBC
51515151
L8L8DB System DB System
ArchitecturesArchitectures Servlets
Java Servlets: Java code that runs on the middle tierPlatform independentComplete Java API available, including JDBC
Example:import java.io.*;import java.servlet.*;import java.servlet.http.*;
public class ServetTemplate extends HttpServlet {public void doGet(HTTPServletRequest request,
HTTPServletResponse response)throws SerletExpection, IOException {
PrintWriter out=response.getWriter();out.println(“Hello World”);
}}
52525252
L8L8DB System DB System
ArchitecturesArchitectures Servlets (Contd.)
Life of a servlet?Webserver forwards request to servlet containerContainer creates servlet instance (calls init() method; deallocation time: calls destroy() method)Container calls service() method
service() calls doGet() for HTTP GET or doPost() for HTTP POSTUsually, don’t override service(), but override doGet() and doPost()
53535353
L8L8DB System DB System
ArchitecturesArchitecturesServlets: A Complete Example
public class ReadUserName extends HttpServlet {public void doGet( HttpServletRequest request,
HttpSevletResponse response)throws ServletException, IOException {reponse.setContentType(“text/html”);PrintWriter out=response.getWriter();out.println(“<HTML><BODY>\n <UL> \n” +
“<LI>” + request.getParameter(“userid”) + “\n” +“<LI>” + request.getParameter(“password”) + “\n” +“<UL>\n<BODY></HTML>”);
}public void doPost( HttpServletRequest request,
HttpSevletResponse response)throws ServletException, IOException {doGet(request,response);
}}
54545454
L8L8DB System DB System
ArchitecturesArchitectures Java Server Pages
ServletsGenerate HTML by writing it to the “PrintWriter” objectCode first, webpage second
JavaServerPagesWritten in HTML, Servlet-like code embedded in the HTMLWebpage first, code secondThey are usually compiled into a Servlet
55555555
L8L8DB System DB System
ArchitecturesArchitectures JavaServerPages: Example
<html><head><title>Welcome to B&N</title></head><body>
<h1>Welcome back!</h1><% String name=“NewUser”;
if (request.getParameter(“username”) != null) {name=request.getParameter(“username”);
}%>You are logged on as user <%=name%><p>
</body></html>
56565656
L8L8DB System DB System
ArchitecturesArchitectures Maintaining State
HTTP is stateless.Advantages
Easy to use: don’t need anythingGreat for static-information applicationsRequires no extra memory space
DisadvantagesNo record of previous requests means
No shopping basketsNo user loginsNo custom or dynamic contentSecurity is more difficult to implement
57575757
L8L8DB System DB System
ArchitecturesArchitectures Application State
Server-side stateInformation is stored in a database, or in the application layer’s local memory
Client-side stateInformation is stored on the client’s computer in the form of a cookie
Hidden stateInformation is hidden within dynamically created web pages
58585858
L8L8DB System DB System
ArchitecturesArchitectures Application State
So many kinds of state…
…how will I choose?
59595959
L8L8DB System DB System
ArchitecturesArchitectures Server-Side State
Many types of Server side state:1. Store information in a database
Data will be safe in the databaseBUT: requires a database access to query or update the information
2. Use application layer’s local memoryCan map the user’s IP address to some stateBUT: this information is volatile and takes up lots of server main memory
5 million IPs = 20 MB
60606060
L8L8DB System DB System
ArchitecturesArchitectures Server-Side State
Should use Server-side state maintenance for information that needs to persist
Old customer orders“Click trails” of a user’s movement through a sitePermanent choices a user makes
61616161
L8L8DB System DB System
ArchitecturesArchitectures Client-side State: Cookies
Storing text on the client which will be passed to the application with every HTTP request.
Can be disabled by the client. Are wrongfully perceived as "dangerous", and therefore will scare away potential site visitors if asked to enable cookies1
Are a collection of (Name, Value) pairs
1http://www.webdevelopersjournal.com/columns/stateful.html
62626262
L8L8DB System DB System
ArchitecturesArchitectures Client State: Cookies
AdvantagesEasy to use in Java Servlets / JSPProvide a simple way to persist non-essential data on the client even when the browser has closed
DisadvantagesLimit of 4 kilobytes of informationUsers can (and often will) disable them
Should use cookies to store interactive stateThe current user’s login informationThe current shopping basketAny non-permanent choices the user has made
66666666
L8L8DB System DB System
ArchitecturesArchitectures Hidden State
Often users will disable cookiesYou can “hide” data in two places:
Hidden fields within a formUsing the path information
Requires no “storage” of information because the state information is passed inside of each web page
67676767
L8L8DB System DB System
ArchitecturesArchitectures Hidden State: Hidden Fields
Declare hidden fields within a form:<input type=‘hidden’ name=‘user’ value=‘username’/>
Users will not see this information (unless they view the HTML source)If used prolifically, it’s a killer for performance since EVERY page must be contained within a form.
68686868
L8L8DB System DB System
ArchitecturesArchitecturesHidden State: Path Information
Path information is stored in the URL request:http://server.com/index.htm?user=jeffd
Can separate ‘fields’ with an & character:index.htm?user=jeffd&preference=pepsi
There are mechanisms to parse this field in Java. Check out the javax.servlet.http.HttpUtils parserQueryString() method.
69696969
L8L8DB System DB System
ArchitecturesArchitectures Multiple state methods
Typically all methods of state maintenance are used:User logs in and this information is stored in a cookieUser issues a query which is stored in the path informationUser places an item in a shopping basket cookieUser purchases items and credit-card information is stored/retrieved from a databaseUser leaves a click-stream which is kept in a log on the web server (which can later be analyzed)
70707070
L8L8DB System DB System
ArchitecturesArchitectures
Extra non-examined materialParallel SystemDistributed System
See R+G ch 22 for more information
Today’s Agenda
71717171
L8L8DB System DB System
ArchitecturesArchitectures Parallel Systems
Parallel database systems consist of multiple processors and multiple disks connected by a fast interconnection network.A coarse-grain parallel machine consists of a small number of powerful processorsA massively parallel or fine grain parallel machine utilizes thousands of smaller processors.Two main performance measures:
throughput --- the number of tasks that can be completed in a given time intervalresponse time --- the amount of time it takes to complete a single task from the time it is submitted
72727272
L8L8DB System DB System
ArchitecturesArchitectures Terminology
Speed-UpMore resources means proportionally less time for given amount of data.
Scale-UpIf resources increased in proportion to increase in data size, time is constant.
degree of parallel
Xact
/sec.
(th
rou
gh
pu
t)
Ideal
degree of parallel
sec.
/Xact
(resp
on
se t
ime) Ideal
73737373
L8L8DB System DB System
ArchitecturesArchitecturesFactors Limiting Speedup and
Scaleup
Speedup and scale-up are often sub-linear due to:Startup costs: Cost of starting up multiple processes may dominate computation time, if the degree of parallelism is high.Interference: Processes accessing shared resources (e.g.,system bus, disks, or locks) compete with each other, thus spending time waiting on other processes, rather than performing useful work.Skew: Increasing the degree of parallelism increases the variance in service times of parallel executing tasks. Overall execution time determined by slowest of parallel executing tasks.
74747474
L8L8DB System DB System
ArchitecturesArchitecturesParallel System
Architectures
Shared memory -- processors share a common memory
Shared disk -- processors share a common disk
Shared nothing -- processors share neither a common memory nor common disk
Hierarchical -- hybrid of the above architectures
75757575
L8L8DB System DB System
ArchitecturesArchitecturesParallel System
Architectures
76767676
L8L8DB System DB System
ArchitecturesArchitectures Shared Memory
Processors and disks have access to a common memory, typically via a bus or through an interconnection network.Extremely efficient communication between processorsData in shared memory can be accessed by any processor without having to move it using software.Downside: architecture is not scalable beyond 32 or 64 processors since the bus or the interconnection network becomes a bottleneckWidely used for lower degrees of parallelism (4 to 8).
77777777
L8L8DB System DB System
ArchitecturesArchitectures Shared Disk
All processors can directly access all disks via an interconnection network, but the processors have private memories.
The memory bus is not a bottleneckArchitecture provides a degree of fault-tolerance — if a processor fails, the other processors can take over its tasks since the database is resident on disks that are accessible from all processors.Examples: IBM Sysplex and DEC clusters (now part of Compaq) running Rdb (now Oracle Rdb) were early commercial users
Downside: bottleneck now occurs at interconnection to the disk subsystem.Shared-disk systems can scale to a somewhat larger number of processors, but communication between processors is slower.
78787878
L8L8DB System DB System
ArchitecturesArchitectures Shared Nothing
Node consists of a processor, memory, and one or more disks. Processors at one node communicate with another processor at another node using an interconnection network. A node functions as the server for the data on the disk or disks the node owns.
Examples: Teradata, Tandem, Oracle-n CUBEData accessed from local disks (and local memory accesses) do not pass through interconnection network, thereby minimizing the interference of resource sharing.Shared-nothing multiprocessors can be scaled up to thousands of processors without interference.Main drawback: cost of communication and non-local disk access; sending data involves software interaction at both ends.
79797979
L8L8DB System DB System
ArchitecturesArchitectures Hierarchical
Combines characteristics of shared-memory, shared-disk, and shared-nothing architectures.Top level is a shared-nothing architecture – nodes connected by an interconnection network, and do not share disks or memory with each other.Each node of the system could be a shared-memory system with a few processors.Alternatively, each node could be a shared-disk system, and each of the systems sharing a set of disks could be a shared-memory system.
80808080
L8L8DB System DB System
ArchitecturesArchitectures Distributed DBMS
Data is stored at several sites, each managed by a DBMS that can run independently.Distributed Data Independence: Users should not have to know where data is located (extends Physical and Logical Data Independence principles).Distributed Transaction Atomicity: Users should be able to write transactions accessing multiple sites just like local transactions.
81818181
L8L8DB System DB System
ArchitecturesArchitectures Recent Trends
Users have to be aware of where data is located, i.e., Distributed Data Independence and Distributed Transaction Atomicity are not supported.These properties are hard to support efficiently.For globally distributed sites, these properties may not even be desirable due to administrative overheads of making the location of the data transparent.
82828282
L8L8DB System DB System
ArchitecturesArchitecturesTypes of Distributed
Databases
Homogeneous: Every site runs the same type of DBMS.
Heterogeneous: Different sites run different DBMSs (different RDBMSs or even non-relational DBMSs).
DBMS1 DBMS2 DBMS3
Gateway
83838383
L8L8DB System DB System
ArchitecturesArchitectures Storing Data
Fragmentation HorizontalVertical
ReplicationGives increased availabilityFaster query evaluation
TID
t1
t2
t3t4
R1
R1 R2
R3
SITE A
SITE B
84848484
L8L8DB System DB System
ArchitecturesArchitecturesDistributed Catalog
Management
Must keep track of how data is distributed across sites.Must be able to name each replica of each fragment.
To preserve local autonomy:<local-name, birth-site>
Site Catalog: Describes all objects (fragments, replicas) at a site + Keeps track of replicas of relations created at this site.
To find a relation, look up its birth-site catalog.Birth-site never changes, even if relation is moved.
85858585
L8L8DB System DB System
ArchitecturesArchitectures Distributed Queries
Horizontally Fragmented: Tuples with rating < 5 at Sydney, >= 5 at Melbourne.
Must compute SUM(age), COUNT(age) at both sites.If WHERE contained just S.rating>6, just one site.
Vertically Fragmented: sid and rating at Sydney, sname and age at Melbourne, tid at both.
Must reconstruct relation by join on tid, then evaluate the query.
Replicated: Sailors copies at both sites.Choice of site based on local costs, shipping costs.
SELECT AVG(S.age)FROM Sailors SWHERE S.rating > 3 AND S.rating < 7