Docsity

Database Systems Lecture 20 Distributed DBMS NOSQL, Slides of Communication

Partial preview of the text

Download Database Systems Lecture 20 Distributed DBMS NOSQL and more Slides Communication in PDF only on Docsity!

CompSci 516

Database Systems Lecture 20 Distributed DBMS NOSQL

Instructor: Sudeepa Roy

Announcements (Tues, 03/22)

• Quiz4 due Thursday

• HW

• Survey on Ed

• Project report deadline 04/

Reading Material

  • [RG]
    • Parallel DBMS: Chapter 22.1-22.
    • Distributed DBMS: Chapter 22.6 – 22.
  • [GUW]
    • Parallel DBMS and map-reduce: Chapter 20.1-20.
    • Distributed DBMS: Chapter 20.3, 20.4.1-20.4.2, 20.5-20.
  • Other recommended readings:
    • Chapter 2 (Sections 1,2,3) of Mining of Massive Datasets, by Rajaraman and Ullman: http://i.stanford.edu/~ullman/mmds.html
    • Original Google MR paper by Jeff Dean and Sanjay Ghemawat, OSDI’ 04: http://research.google.com/archive/mapreduce.html Acknowledgement: The following slides have been created adapting the instructor material of the [RG] book provided by the authors Dr. Ramakrishnan and Dr. Gehrke.

Distributed DBMS

Distributed Data Independence

• Users should not have to know where data is

located

  • no need to know the locations of references

relations, their copies or fragments (later)

  • extends Physical and Logical Data Independence

principles

• Queries spanning multiple sites should be

optimized in a cost-based manner

  • taking into account communication costs and

differences in local computation costs

Distributed DBMS Architectures

• Three alternative approaches

1. Client-Server

  • Client: user interace, server: executes queries

2. Collaborating Server

  • All are of the same status

3. Middleware

  • Good for integrating legacy systems, middleware
coordinates, individual server executes local queries

CLIENT CLIENT SERVER SERVER SERVER QUERY SERVER SERVER SERVER QUERY

Joins in a Distributed DBMS

• Can be very expensive if relations are stored at

different sites

1. Fetch as needed

2. Ship to one site

3. Semi-join

4. Bloom join

Sailors (S) Reserves (R) LONDON PARIS 500 pages 1000 pages Sailors as outer – for each S page, fetch all R pages from Paris if cached at London, each R page fetched once Ship Sailor to Paris Unnecessary shipping Not all tuples used

Semijoin

  • Suppose want to ship R to London and then do join with S at
London. Instead,
1. At London, project S onto join columns and ship this to Paris
  • Here foreign keys, but could be arbitrary join
2. At Paris, join S-projection with R
  • Result is called reduction of Reserves w.r.t. Sailors (only these tuples are needed)
3. Ship reduction of R to back to London
4. At London, join S with reduction of R

LONDON PARIS 500 pages 1000 pages Sailors (S) Reserves (R)

  • Tradeoff the cost of computing and shipping projection for cost of shipping full R relation - Especially useful if there is a selection on Sailors, and answer desired at London

Distributed Query Optimization

  • Similar to centralized optimization, but have differences

1. Communication costs must be considered

2. Local site autonomy must be respected

3. New distributed join methods should be considered

• Query site constructs global plan, with suggested

local plans describing processing at each site

  • If a site can improve suggested local plan, free to do so

Review

Updating Distributed Data

  • Synchronous Replication: All copies of a modified relation (or
fragment) must be updated before the modifying transaction
commits
  • Always updated but expensive commit protocols (2PC – soon!)
  • By “voting” - e.g., 10 copies; 7 written for update; 4 copies read (why 4?)
  • Read-any Write-all (special case of voting, why not write-any read all?)
  • Asynchronous Replication: Copies of a modified relation are only
periodically updated; different copies may get out-of-sync in the
meantime
  • More efficient – many current products follow this approach
  • Primary site (one master copy) or peer-to-peer (multiple master copies)

Distributed Locking

  • How do we manage locks for objects across many sites?
  1. Centralized: One site does all locking
    • Vulnerable to single site failure
  2. Primary Copy: All locking for an object done at the primary copy site
    • Reading requires access to locking site as well as site where the object copy is stored
  3. Fully Distributed: Locking for a copy done at site where the copy is stored
    • Locks at all sites while writing an object (unlike previous two)
    • May lead to “undetected” or “missing” ”global deadlock” due to delay in information propagation
    • Timeout or hierarchical detection
      • e.g. sites (every 10 sec)-> sites in a state (every min)-> sites in a country (every 10 min) - > global waits for graph. Intuition: more deadlocks are likely across closely related sites T1 T2 T1 T2 T1 T SITE A SITE B GLOBAL

Two-Phase Commit (2PC)

• Site at which transaction originates is

coordinator

• Other sites at which it executes are

subordinates

– w.r.t. coordination of this transaction

Example on slides

When a transaction wants to commit – 1/

  1. Coordinator sends prepare message to each subordinate