Published on

1 Comment
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • 1
  • 5
  • 6
  • 7
  • 8
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 22
  • 23
  • 24
  • 26
  • 27
  • 28
  • 29
  • 32
  • 32
  • 32
  • 32
  • 32
  • CH10.ppt

    1. 1. Chapter 10 Distributed Database Management System Database Systems: Design, Implementation, and Management 4th Edition
    2. 2. The Evolution of Distributed DBMS <ul><li>Centralized DBMS in the 1970’s </li></ul><ul><ul><li>Support for structured information needs. </li></ul></ul><ul><ul><li>Regularly issued formal reports in standard formats. </li></ul></ul><ul><ul><li>Prepared by specialist using 3GL in response to precisely channeled request. </li></ul></ul><ul><ul><li>Centrally stored corporate data. </li></ul></ul><ul><ul><li>Data access through dumb terminals. </li></ul></ul><ul><ul><li>Incapable of providing quick, unstructured, and ad hoc information for decision makers in a dynamic business environment. </li></ul></ul>
    3. 3. The Evolution of Distributed DBMS <ul><li>Social and Technical Changes in the 1980’s </li></ul><ul><ul><li>Business operations became more decentralized geographically. </li></ul></ul><ul><ul><li>Competition increased at the global level. </li></ul></ul><ul><ul><li>Customer demands and market needs favored a decentralized management style. </li></ul></ul><ul><ul><li>Rapid technological change created low-cost microcomputers. The LANs became the basis for computerized solutions. </li></ul></ul><ul><ul><li>The large number of applications based on DBMSs and the need to protect investments in centralized DBMS software made the notion of data sharing attractive. </li></ul></ul>
    4. 4. The Evolution of Distributed DBMS <ul><li>Two Database Requirements in a Dynamic Business Environment: </li></ul><ul><ul><li>Quick ad hoc data access became crucial in the quick-response decision making environment. </li></ul></ul><ul><ul><li>The decentralization of management structure based on the decentralization of business units made decentralized multiple-access and multiple-location databases a necessity. </li></ul></ul><ul><li>Developments in the 1990’s affecting DBMS </li></ul><ul><ul><li>The growing acceptance of the Internet and the World Wide Web as the platform for data access and distribution. </li></ul></ul><ul><ul><li>The increased focus on data analysis that led to data mining and data warehousing . </li></ul></ul>
    5. 5. The Evolution of Distributed DBMS <ul><li>DDBMS Advantages </li></ul><ul><ul><li>Data are located near the “greatest demand” site. </li></ul></ul><ul><ul><li>Faster data access </li></ul></ul><ul><ul><li>Faster data processing </li></ul></ul><ul><ul><li>Growth facilitation </li></ul></ul><ul><ul><li>Improved communications </li></ul></ul><ul><ul><li>Reduced operating costs </li></ul></ul><ul><ul><li>User-friendly interface </li></ul></ul><ul><ul><li>Less danger of a single-point failure </li></ul></ul><ul><ul><li>Processor independence </li></ul></ul><ul><li>DDBMS Disadvantages </li></ul><ul><ul><li>Complexity of management and control </li></ul></ul><ul><ul><li>Security </li></ul></ul><ul><ul><li>Lack of standards </li></ul></ul><ul><ul><li>Increased storage requirements </li></ul></ul>
    6. 6. Distributed Processing and Distributed Database <ul><li>Distributed processing shares the database’s logical processing among two or more physically independent sites that are connected through a network. (See Figure 10.1) </li></ul><ul><li>Distributed database stores a logically related database over two or more physically independent sites connected via a computer network. (See Figure 10.2) </li></ul>
    7. 7. Distributed Processing Environment Figure 10.1
    8. 8. Distributed Database Environment Figure 10.2
    9. 9. Distributed Processing and Distributed Database <ul><li>Distributed processing does not require a distributed database, but a distributed database requires distributed processing. </li></ul><ul><li>Distributed processing may be based on a single database located on a single computer. In order to manage distributed data, copies or parts of the database processing functions must be distributed to all data storage sites. </li></ul><ul><li>Both distributed processing and distributed databases require a network to connect all components. </li></ul>
    10. 10. What Is A Distributed DBMS? <ul><li>A distributed database management system ( DDBMS ) governs the storage and processing of logically related data over interconnected computer systems in which both data and processing functions are distributed among several sites. </li></ul>
    11. 11. What Is A Distributed DBMS? <ul><li>Functions of a DDBMS </li></ul><ul><ul><li>Application interface </li></ul></ul><ul><ul><li>Validation to analyze data requests </li></ul></ul><ul><ul><li>Transformation to determine request’s components </li></ul></ul><ul><ul><li>Query-optimization to find the best access strategy </li></ul></ul><ul><ul><li>Mapping to determine the data location </li></ul></ul><ul><ul><li>I/O interface to read or write data </li></ul></ul><ul><ul><li>Formatting to prepare the data for presentation </li></ul></ul><ul><ul><li>Security to provide data privacy </li></ul></ul><ul><ul><li>Backup and recovery </li></ul></ul><ul><ul><li>Database administration </li></ul></ul><ul><ul><li>Concurrency control </li></ul></ul><ul><ul><li>Transaction management </li></ul></ul>
    12. 12. Centralized Database Management System Figure 10.3
    13. 13. Fully Distributed Database Management System Figure 10.4
    14. 14. DDBMS Components <ul><li>Computer workstations that form the network system. </li></ul><ul><li>Network hardware and software components that reside in each workstation. </li></ul><ul><li>Communications media that carry the data from one workstation to another. </li></ul><ul><li>Transaction processor ( TP ) receives and processes the application’s data requests. </li></ul><ul><li>Data processor ( DP ) stores and retrieves data located at the site. Also known as data manager ( DM ). </li></ul>
    15. 15. Distributed Database System Components Figure 10.5
    16. 16. DDBMS Components <ul><li>DDBMS protocol determines how the DDBMS will: </li></ul><ul><ul><li>Interface with the network to transport data and commands between DPs and TPs. </li></ul></ul><ul><ul><li>Synchronize all data received from DPs (TP side) and route retrieved data to the appropriate TPs (DP side). </li></ul></ul><ul><ul><li>Ensure common database functions in a distributed system -- security, concurrency control, backup, and recovery. </li></ul></ul>
    17. 17. Levels of Data & Process Distribution <ul><li>Single-Site Processing, Single-Site Data (SPSD) </li></ul><ul><ul><li>All processing is done on a single CPU or host computer. </li></ul></ul><ul><ul><li>All data are stored on the host computer’s local disk. </li></ul></ul><ul><ul><li>The DBMS is located on the host computer. </li></ul></ul><ul><ul><li>The DBMS is accessed by dumb terminals. </li></ul></ul><ul><ul><li>Typical of most mainframe and minicomputer DBMSs. </li></ul></ul><ul><ul><li>Typical of the 1st generation of single-user microcomputer database. </li></ul></ul>Table 10.1
    18. 18. Nondistributed (Centralized) DBMS Figure 10.6
    19. 19. Levels of Data & Process Distribution <ul><li>Multiple-Site Processing, Single-Site Data (MPSD) </li></ul><ul><ul><li>Typically, MPSD requires a network file server on which conventional applications are accessed through a LAN. </li></ul></ul><ul><ul><li>A variation of the MPSD approach is known as a client/server architecture. (Chapter 12) </li></ul></ul>Figure 10.7
    20. 20. Levels of Data & Process Distribution <ul><li>Multiple-Site Processing, Multiple-Site Data (MPMD) </li></ul><ul><ul><li>Fully distributed DBMS with support for multiple DPs and TPs at multiple sites. </li></ul></ul><ul><ul><ul><li>Homogeneous DDMS integrate only one type of centralized DBMS over the network. </li></ul></ul></ul><ul><ul><ul><li>Heterogeneous DDBMS integrate different types of centralized DBMSs over a network. (See Figure 10.8) </li></ul></ul></ul>
    21. 21. Figure 10.8 Heterogeneous Distributed Database Scenario
    22. 22. Distributed DB Transparency <ul><li>DDBMS transparency features have the common property of allowing the end users to think that he is the database’s only user. </li></ul><ul><ul><li>Distribution transparency </li></ul></ul><ul><ul><li>Transaction transparency </li></ul></ul><ul><ul><li>Failure transparency </li></ul></ul><ul><ul><li>Performance transparency </li></ul></ul><ul><ul><li>Heterogeneity transparency </li></ul></ul>
    23. 23. Distribution Transparency <ul><li>Distribution transparency allows us to manage a physically dispersed database as though it were a centralized database. </li></ul><ul><li>Three Levels of Distribution Transparency </li></ul><ul><ul><li>Fragmentation transparency </li></ul></ul><ul><ul><li>Location transparency </li></ul></ul><ul><ul><li>Local mapping transparency </li></ul></ul>Table 10.2
    24. 24. Distribution Transparency <ul><li>Example (Figure 10.9): Employee data (EMPLOYEE) are distributed over three locations: New York, Atlanta, and Miami. Depending on the level of distribution transparency support, three different cases of queries are possible: </li></ul>Figure 10.9 Fragment Locations
    25. 25. Distribution Transparency <ul><li>Case 1: DB Supports Fragmentation Transparency </li></ul><ul><ul><li>SELECT * FROM EMPLOYEE WHERE EMP_DOB < ‘01-JAN-1940’; </li></ul></ul>
    26. 26. Distribution Transparency <ul><li>Case 2: DB Supports Location Transparency </li></ul><ul><ul><li>SELECT * FROM E1 WHERE EMP_DOB < ‘01-JAN-1940’; </li></ul></ul><ul><ul><li>UNION </li></ul></ul><ul><ul><li>SELECT * FROM E2 WHERE EMP_DOC < ‘01-JAN-1940’; </li></ul></ul><ul><ul><li>UNION </li></ul></ul><ul><ul><li>SELECT * FROM E3 WHERE EMP_DOC < ‘01-JAN-1940’; </li></ul></ul>
    27. 27. Distribution Transparency <ul><li>Case 3: DB Supports Local Mapping Transparency </li></ul><ul><ul><li>SELECT * FROM E1 NODE NY WHERE EMP_DOB < ‘01-JAN-1940’; </li></ul></ul><ul><ul><li>UNION </li></ul></ul><ul><ul><li>SELECT * FROM E2 NODE ATL WHERE EMP_DOC < ‘01-JAN-1940’; </li></ul></ul><ul><ul><li>UNION </li></ul></ul><ul><ul><li>SELECT * FROM E3 NODE MIA WHERE EMP_DOC < ‘01-JAN-1940’; </li></ul></ul>
    28. 28. Distribution Transparency <ul><li>Distribution transparency is supported by distributed data dictionary (DDD) or a distributed data catalog (DDC) . </li></ul><ul><li>The DDC contains the description of the entire database as seen by the database administrator. </li></ul><ul><li>The database description, known as the distributed global schema , is the common database schema used by local TPs to translate user requests into subqueries. </li></ul>
    29. 29. Transaction Transparency <ul><li>Transaction transparency ensures that database transactions will maintain the database’s integrity and consistency. The transaction will be completed only if all database sites involved in the transaction complete their part of the transaction. </li></ul><ul><li>Related Concepts : </li></ul><ul><ul><li>Remote Requests </li></ul></ul><ul><ul><li>Remote Transactions </li></ul></ul><ul><ul><li>Distributed Transactions </li></ul></ul><ul><ul><li>Distributed Requests </li></ul></ul>
    30. 30. Transaction Transparency <ul><li>Distributed Requests and Distributed Transactions </li></ul><ul><ul><li>A remote request allows us to access data to be processed by a single remote database processor. (Figure 10.10) </li></ul></ul><ul><ul><li>A remote transaction , composed of several requests, may access data at only a single site. (Figure 10.11) </li></ul></ul><ul><ul><li>A distributed transaction allows a transaction to reference several different (local or remote) DP sites. (Figure 10.12) </li></ul></ul><ul><ul><li>A distributed request lets us reference data from several remote DP sites. (Figure 10.13) It also allows a single request to reference a physically partitioned table. (Figure 10.14) </li></ul></ul>
    31. 31. A Remote Request Figure 10.10
    32. 32. A Remote Transaction Figure 10.11
    33. 33. A Distributed Transaction Figure 10.12
    34. 34. A Distributed Request Figure 10.13
    35. 35. Another Distributed Request Figure 10.14
    36. 36. Figure 10.15
    37. 37. Transaction Transparency <ul><li>Two-Phase Commit Protocol </li></ul><ul><ul><li>The two-phase commit protocol guarantees that, if a portion of a transaction operation cannot be committed, all changes made at the other sites participating in the transaction will be undone to maintain a consistent database state. </li></ul></ul><ul><ul><li>Each DP maintains its own transaction log . The two-phase protocol requires that each individual DP’s transaction log entry be written before the database fragment is actually updated. </li></ul></ul><ul><ul><li>The two-phase commit protocol requires a DO-UNDO-REDO protocol and a write-ahead protocol . </li></ul></ul>
    38. 38. Transaction Transparency <ul><li>Two-Phase Commit Protocol </li></ul><ul><ul><li>The DO-UNDO-REDO protocol is used by the DP to roll back and/or roll forward transactions with the help of the system’s transaction log entries. </li></ul></ul><ul><ul><ul><li>DO performs the operation and records the “before” and “after” values in the transaction log. </li></ul></ul></ul><ul><ul><ul><li>UNDO reverses an operation, using the log entries written by the DO portion of the sequence. </li></ul></ul></ul><ul><ul><ul><li>REDO redoes an operation, using the log entries written by DO portion of the sequence. </li></ul></ul></ul><ul><ul><li>The write-ahead protocol forces the log entry to be written to permanent storage before the actual operation takes place. </li></ul></ul>
    39. 39. Transaction Transparency <ul><li>Two-Phase Commit Protocol </li></ul><ul><li>Two-phase commit protocol defines the operations between two types of nodes: the coordinator and one or more subordinates or cohorts . The protocol is implemented in two phases: </li></ul><ul><ul><li>Phase 1: Preparation </li></ul></ul><ul><ul><ul><li>The coordinator sends a PREPARE TO COMMIT message to all subordinates. </li></ul></ul></ul><ul><ul><ul><li>The subordinates receive the message, write the transaction log using the write-ahead protocol, and send an acknowledgement message to the coordinator. </li></ul></ul></ul><ul><ul><ul><li>The coordinator makes sure that all nodes are ready to commit, or it aborts the transaction. </li></ul></ul></ul>
    40. 40. Transaction Transparency <ul><ul><li>Phase 2: The Final Commit </li></ul></ul><ul><ul><ul><li>The coordinator broadcasts a COMMIT message to all subordinates and waits for the replies. </li></ul></ul></ul><ul><ul><ul><li>Each subordinate receives the COMMIT message then updates the database, using the DO protocol. </li></ul></ul></ul><ul><ul><ul><li>The subordinates reply with a COMMITTED or NOT COMMITTED message to the coordinator. </li></ul></ul></ul><ul><ul><li>If one or more subordinates did not commit, the coordinator sends an ABORT message, thereby forcing them to UNDO all changes. </li></ul></ul>
    41. 41. Performance Transparency and Query Optimization <ul><li>The objective of a query optimization routine is to minimize the total cost associated with the execution of a request. The costs associated with a request are a function of the: </li></ul><ul><ul><li>Access time (I/O) cost involved in accessing the physical data stored on disk. </li></ul></ul><ul><ul><li>Communication cost associated with the transmission of data among nodes in distributed database systems. </li></ul></ul><ul><ul><li>CPU time cost associated with the processing overhead of managing distributed transactions. </li></ul></ul>
    42. 42. <ul><li>Query optimization must provide distribution transparency as well as replica transparency . </li></ul><ul><li>Replica transparency refers to the DDBMSs ability to hide the existence of multiple copies of data from the user. </li></ul><ul><li>Most of the query optimization algorithms are based on two principles: </li></ul><ul><ul><li>Selection of the optimum execution order </li></ul></ul><ul><ul><li>Selection of sites to be accessed to minimize communication costs </li></ul></ul>Performance Transparency and Query Optimization
    43. 43. <ul><li>Operation Modes of Query Optimization </li></ul><ul><ul><li>Automatic query optimization means that the DDBMS finds the most cost-effective access path without user intervention. </li></ul></ul><ul><ul><li>Manual query optimization requires that the optimization be selected and scheduled by the end user or programmer. </li></ul></ul><ul><li>Timing of Query Optimization </li></ul><ul><ul><li>Static query optimization takes place at compilation time. </li></ul></ul><ul><ul><li>Dynamic query optimization takes place at execution time . </li></ul></ul>Performance Transparency and Query Optimization
    44. 44. <ul><li>Optimization Techniques by Information Used </li></ul><ul><ul><li>Statistically based query optimization uses statistical information about the database. </li></ul></ul><ul><ul><ul><li>In the dynamic statistical generation mode, the DDBMS automatically evaluates and updates the statistics after each access. </li></ul></ul></ul><ul><ul><ul><li>In the manual statistical generation mode, the statistics must be updated periodically through a user-selected utility. </li></ul></ul></ul><ul><ul><li>Rule-based query optimization algorithm is based on a set of user-defined rules to determine the best query access strategy. </li></ul></ul>Performance Transparency and Query Optimization
    45. 45. Distributed Database Design <ul><li>The design of a distributed database introduces three new issues: </li></ul><ul><ul><li>How to partition the database into fragments. </li></ul></ul><ul><ul><li>Which fragments to replicate . </li></ul></ul><ul><ul><li>Where to locate those fragments and replicas. </li></ul></ul>
    46. 46. Data Fragmentation <ul><li>Data fragmentation allows us to break a single object into two or more segments or fragments. </li></ul><ul><li>Each fragment can be stored at any site over a computer network. </li></ul><ul><li>Data fragmentation information is stored in the distributed data catalog (DDC), from which it is accessed by the transaction processor (TP) to process user requests. </li></ul><ul><li>Three Types of Fragmentation Strategies : </li></ul><ul><ul><li>Horizontal fragmentation </li></ul></ul><ul><ul><li>Vertical fragmentation </li></ul></ul><ul><ul><li>Mixed fragmentation </li></ul></ul>
    47. 47. A Sample CUSTOMER Table Figure 10.16
    48. 48. Data Fragmentation <ul><li>Horizontal Fragmentation Division of a relation into subsets ( fragments ) of tuples ( rows ). Each fragment is stored at a different node, and each fragment has unique rows. Each fragment represents the equivalent of a SELECT statement, with the WHERE clause on a single attribute. </li></ul>Table 10.3 Horizontal Fragmentation of the CUSTOMER Table By State
    49. 49. Table Fragments In Three Locations Figure 10.17
    50. 50. Data Fragmentation <ul><li>Vertical Fragmentation Division of a relation into attribute ( column ) subsets . Each subset (fragment) is stored at a different node, and each fragment has unique columns -- with the exception of the key column. This is the equivalent of the PROJECT statement. </li></ul>Table 10.4 Vertical Fragmentation of the CUSTOMER Table
    51. 51. Vertically Fragmented Table Contents Figure 10.18
    52. 52. Data Fragmentation <ul><li>Mixed Fragmentation Combination of horizontal and vertical strategies. A table may be divided into several horizontal subsets (rows), each one having a subset of the attributes (columns). </li></ul>
    53. 53. Table 10.5 Mixed Fragmentation of the CUSTOMER Table
    54. 54. Figure 10.19
    55. 55. Data Replication <ul><li>Data replication refers to the storage of data copies at multiple sites served by a computer network. </li></ul><ul><ul><li>Fragment copies can be stored at several sites to serve specific information requirements. </li></ul></ul><ul><ul><li>The existence of fragment copies can enhance data availability and response time, reducing communication and total query costs. </li></ul></ul>Figure 10.20
    56. 56. Data Replication <ul><li>Mutual Consistency Rule </li></ul><ul><ul><li>Replicated data are subject to the mutual consistency rule , which requires that all copies of data fragments be identical. </li></ul></ul><ul><ul><li>DDBMS must ensure that a database update is performed at all sites where replicas exist. </li></ul></ul><ul><ul><li>Data replication imposes additional DDBMS processing overhead. </li></ul></ul>
    57. 57. Data Replication <ul><li>Replication Conditions </li></ul><ul><ul><li>A fully replicated database stores multiple copies of all database fragments at multiple sites. </li></ul></ul><ul><ul><li>A partially replicated database stores multiple copies of some database fragments at multiple sites. </li></ul></ul><ul><li>Factors for Data Replication Decision </li></ul><ul><ul><li>Database Size </li></ul></ul><ul><ul><li>Usage Frequency </li></ul></ul>
    58. 58. Data Allocation <ul><li>Data allocation describes the processing of deciding where to locate data. </li></ul><ul><li>Data Allocation Strategies </li></ul><ul><ul><li>Centralized The entire database is stored at one site. </li></ul></ul><ul><ul><li>Partitioned The database is divided into several disjoint parts (fragments) and stored at several sites. </li></ul></ul><ul><ul><li>Replicated Copies of one or more database fragments are stored at several sites . </li></ul></ul>
    59. 59. Data Allocation <ul><li>Data allocation algorithms take into consideration a variety of factors: </li></ul><ul><ul><li>Performance and data availability goals </li></ul></ul><ul><ul><li>Size, number of rows, the number of relations that an entity maintains with other entities. </li></ul></ul><ul><ul><li>Types of transactions to be applied to the database, the attributes accessed by each of those transactions. </li></ul></ul>
    60. 60. Client/Server vs. DDBMS <ul><li>Client/server architecture refers to the way in which computers interact to form a system. </li></ul><ul><li>It features a user of resources or a client and a provider of resources or a server . </li></ul><ul><li>The architecture can be used to implement a DBMS in which the client is the transaction processor (TP) and the server is the data processor (DP). </li></ul>
    61. 61. Client/Server Architecture <ul><li>Client/Server Advantages </li></ul><ul><ul><li>Client/server solutions tend to be less expensive. </li></ul></ul><ul><ul><li>Client/server solutions allow the end user to use the microcomputer’s graphical user interface (GUI), thereby improving functionality and simplicity. </li></ul></ul><ul><ul><li>There are more people with PC skills than with mainframe skills. </li></ul></ul><ul><ul><li>The PC is well established in the workplace. </li></ul></ul><ul><ul><li>Numerous data analysis and query tools exist to facilitate interaction with many of the DBMSs. </li></ul></ul><ul><ul><li>There are considerable cost advantages to off-loading application development from the mainframe to PCs. </li></ul></ul>
    62. 62. Client/Server Architecture <ul><li>Client/Server Disadvantages </li></ul><ul><ul><li>The client/server architecture creates a more complex environment with different platforms. </li></ul></ul><ul><ul><li>An increase in the number of users and processing sites often paves the way for security problems. </li></ul></ul><ul><ul><li>The burden of training a wider circle of users and computer personnel increases the cost of maintaining the environment. </li></ul></ul>
    63. 63. C. J. Date’s 12 Commandments for Distributed Database <ul><li>1 . Local Site Independence </li></ul><ul><li>2. Central Site Independence </li></ul><ul><li>3. Failure Independence </li></ul><ul><li>4. Location Transparency </li></ul><ul><li>5. Fragmentation Transparency </li></ul><ul><li>6. Replication Transparency </li></ul><ul><li>7. Distributed Query Processing </li></ul><ul><li>8. Distributed Transaction Processing </li></ul><ul><li>9. Hardware Independence </li></ul><ul><li>10. Operating System Independence </li></ul><ul><li>11. Network Independence </li></ul><ul><li>12. Database Independence </li></ul>