Distirbuted DataBase -Parallel

Embed Size (px)

Citation preview

  • 8/9/2019 Distirbuted DataBase -Parallel

    1/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.1

    Outline

    I IntroductionI BackgroundI Distributed DBMS ArchitectureI Distributed Database DesignI Semantic Data Control

    I Distributed Query ProcessingI Distributed Transaction Management

    Data server approachParallel architecturesParallel DBMS techniquesParallel execution models

    Parallel Database Systems Distributed Object DBMS Database Interoperability Concluding Remarks

  • 8/9/2019 Distirbuted DataBase -Parallel

    2/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.2

    I Large volume of data use disk and large main memory

    I I/O bottleneck (or memory access bottleneck) Speed(disk)

  • 8/9/2019 Distirbuted DataBase -Parallel

    3/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.3

    I Increase the I/O bandwidth

    Data partitioning Parallel data access

    I Origins (1980's): database machines

    Hardware-oriented bad cost-performance failure

    Notable exception : ICL's CAFS Intelligent Search Processor

    I 1990's: same solution but using standard hardwarecomponents integrated in a multiprocessor Software-oriented

    Standard essential to exploit continuing technology improvements

    The Solution

  • 8/9/2019 Distirbuted DataBase -Parallel

    4/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.4

    I High-performance with better cost-performancethan mainframe or vector supercomputer

    I Use many nodes, each with good cost-performance, communicating through networkGood cost via high-volume components

    Good performance via bandwidthI Trends

    Microprocessor and memory (DRAM): off-the-shelf

    Network (multiprocessor edge): custom

    I The real chalenge is to parallelize applications torun with good load balancing

    Multiprocessor Objectives

  • 8/9/2019 Distirbuted DataBase -Parallel

    5/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.5

    Data Server Architecture

    client interface

    query parsing

    data server interface

    communication channel

    Application

    server

    Data

    server

    database

    application server interface

    database functions

    Client

  • 8/9/2019 Distirbuted DataBase -Parallel

    6/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.6

    Objectives of Data Servers

    Avoid the shortcomings of the traditional DBMS

    approach Centralization of data and application management

    General-purpose OS (not DB-oriented)

    By separating the functions between Application server (or host computer)

    Data server (or database computer or back-end computer)

  • 8/9/2019 Distirbuted DataBase -Parallel

    7/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.7

    Data Server Approach: Assessment

    I Advantages

    Integrated data control by the server (black box) Increased performance by dedicated system

    Can better exploit parallelism

    Fits well in distributed environments

    I Potential problemsCommunication overhead between application and data

    server

    N High-level interfaceHigh cost with mainframe servers

  • 8/9/2019 Distirbuted DataBase -Parallel

    8/42

  • 8/9/2019 Distirbuted DataBase -Parallel

    9/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.9

    Data-based Parallelism

    I Inter-operationp operations of the same query in parallel

    op.3

    op.1 op.2

    op.

    R

    op.

    R1

    op.

    R2

    op.

    R2

    op.

    R4

    I Intra-operation the same operation in parallel on different data partitions

  • 8/9/2019 Distirbuted DataBase -Parallel

    10/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.10

    I Loose definition: a DBMS implemented on a tighlycoupled multiprocessor

    I Alternative extremes

    Straighforward porting of relational DBMS (the software vendor

    edge) New hardware/software combination (the computer manufacturer

    edge)

    I Naturally extends to distributed databases with one

    server per site

    Parallel DBMS

  • 8/9/2019 Distirbuted DataBase -Parallel

    11/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.11

    I Much better cost / performance than mainframesolution

    I High-performance through parallelism High throughput with inter-query parallelism

    Low response time with intra-operation parallelism

    I

    High availability and reliability by exploiting datareplication

    I Extensibility with the ideal goals Linear speed-up

    Linear scale-up

    Parallel DBMS - Objectives

  • 8/9/2019 Distirbuted DataBase -Parallel

    12/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.12

    Linear increase in performance for a constant DB

    size and proportional increase of the systemcomponents (processor, memory, disk)

    new perf.

    old perf.

    ideal

    components

    Linear Speed-up

  • 8/9/2019 Distirbuted DataBase -Parallel

    13/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.13

    Sustained performance for a linear increase ofdatabase size and proportional increase of thesystem components.

    components + database size

    new perf.

    old perf.

    Linear Scale-up

    ideal

  • 8/9/2019 Distirbuted DataBase -Parallel

    14/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.14

    Barriers to Parallelism

    I Startup

    The time needed to start a parallel operation maydominate the actual computation time

    I InterferenceWhen accessing shared resources, each new process slows

    down the others (hot spot problem)

    I SkewThe response time of a set of parallel processes is the time

    of the slowest one

    I

    Parallel data management techniques intendto overcome these barriers

  • 8/9/2019 Distirbuted DataBase -Parallel

    15/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.15

    Parallel DBMS

    Functional Architecture

    RMtask n

    DMtask 12

    DMtask n2

    DMtask n1

    Data MgrDMtask 11

    Request MgrRMtask 1

    Session Mgr

    Usertask 1

    Usertask n

  • 8/9/2019 Distirbuted DataBase -Parallel

    16/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.16

    Parallel DBMS Functions

    I Session manager Host interface Transaction monitoring for OLTP

    I Request manager Compilation and optimization Data directory management Semantic data control Execution control

    I Data manager Execution of DB operations

    Transaction management support Data management

  • 8/9/2019 Distirbuted DataBase -Parallel

    17/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.17

    Parallel System Architectures

    I Multiprocessor architecture alternatives Shared memory (shared everything)

    Shared disk

    Shared nothing (message-passing)

    I Hybrid architectures

    Hierarchical (cluster)

    Non-Uniform Memory Architecture (NUMA)

  • 8/9/2019 Distirbuted DataBase -Parallel

    18/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.18

    Shared-Memory Architecture

    Examples: DBMS on symmetric multiprocessors (Sequent,Encore, Sun, etc.) Simplicity, load balancing, fast communication Network cost, low extensibility

    P1 Pn

    Global Memory

    D

    interconnect

  • 8/9/2019 Distirbuted DataBase -Parallel

    19/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.19

    Shared-Disk Architecture

    Examples : DEC's VAXcluster, IBM's IMS/VS Data Sharing network cost, extensibility, migration from uniprocessor complexity, potential performance problem for copy

    coherency

    D

    P1

    M1

    Pn

    Mn

    interconnect

  • 8/9/2019 Distirbuted DataBase -Parallel

    20/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.20

    Shared-Nothing Architecture

    Examples : Teradata (NCR), NonStopSQL (Tandem-Compaq),Gamma (U. of Wisconsin), Bubba (MCC) Extensibility, availability Complexity, difficult load balancing

    P1

    M1

    D1

    Pn

    Mn

    Dn

    interconnect

  • 8/9/2019 Distirbuted DataBase -Parallel

    21/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.21

    I Combines good load balancing of SM with extensibilityof SN

    I Alternatives Limited number of large nodes, e.g., 4 x 16 processor nodes

    High number of small nodes, e.g., 16 x 4 processor nodes, hasmuch better cost-performance (can be a cluster of workstations)

    Hierarchical Architecture

    P1 Pn

    Global Memory

    D

    interconnect

    P1 Pn

    Global Memory

    D

    interconnect

  • 8/9/2019 Distirbuted DataBase -Parallel

    22/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.22

    I Mixes two different aspects : addressing andmemoryAddressing

    N Single address space : Sequent, Encore, KSR

    N Multiple address spaces : Intel, Ncube

    Physical memory

    N Central : Sequent, EncoreN Distributed : Intel, Ncube, KSR

    I NUMA : single address space on distributedphysical memoryEases application portabilityExtensibility

    Shared-Memory vs.

    Distributed Memory

  • 8/9/2019 Distirbuted DataBase -Parallel

    23/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.23

    NUMA Architectures

    I Cache Coherent NUMA (CC-NUMA)

    statically divide the main memory among the nodesI Cache Only Memory Architecture (COMA)

    convert the per-node memory into a large cache of theshared address space

  • 8/9/2019 Distirbuted DataBase -Parallel

    24/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.24

    COMA Architecture

    Hardware shared virtual memory

    P1

    Cache

    Memory

    Disk

    P2

    Cache

    Memory

    Disk

    Pn

    Cache

    Memory

    Disk

  • 8/9/2019 Distirbuted DataBase -Parallel

    25/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.25

    I Data placementPhysical placement of the DB onto multiple nodes

    Static vs. Dynamic

    I Parallel data processingSelect is easy

    Join (and all other non-select operations) is more difficultI Parallel query optimization

    Choice of the best parallel execution plans

    Automatic parallelization of the queries and load balancing

    I Transaction managementSimilar to distributed transaction management

    Parallel DBMS Techniques

  • 8/9/2019 Distirbuted DataBase -Parallel

    26/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.26

    I Each relation is divided in n partitions (subrelations),where n is a function of relation size and access

    frequencyI Implementation

    Round-robin

    N Maps i-th element to node i mod n

    N Simple but only exact-match queries

    B-tree index

    N Supports range queries but large index

    Hash function

    N Only exact-match queries but small index

    Data Partitioning

  • 8/9/2019 Distirbuted DataBase -Parallel

    27/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.27

    Partitioning Schemes

    Round-Robin Hashing

    Interval

    a-g h-m u-z

  • 8/9/2019 Distirbuted DataBase -Parallel

    28/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.28

    Replicated Data Partitioning

    I High-availability requires data replication

    simple solution is mirrored disksN hurts load balancing when one node fails

    more elaborate solutions achieve load balancing

    N interleaved partitioning (Teradata)

    N chained partitioning (Gamma)

  • 8/9/2019 Distirbuted DataBase -Parallel

    29/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.29

    Interleaved Partitioning

    Node

    Primary copy R1 R2 R3 R4

    Backup copy r 1.1 r 1.2 r 1.3

    r 2.3 r 2.1 r 2.2

    r 3.2 r 3.2 r 3.1

    1 2 3 4

  • 8/9/2019 Distirbuted DataBase -Parallel

    30/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.30

    Chained Partitioning

    Node

    Primary copy R1 R2 R3 R4

    Backup copy r4 r1 r2 r3

    1 2 3 4

  • 8/9/2019 Distirbuted DataBase -Parallel

    31/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.31

    Placement Directory

    I Performs two functions

    F1 (relname, placement attval) = lognode-idF2 (lognode-id) = phynode-id

    I In either case, the data structure forf1 andf2

    should be available when needed at each node

  • 8/9/2019 Distirbuted DataBase -Parallel

    32/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.32

    Join Processing

    I Three basic algorithms for intra-operator

    parallelismParallel nested loop join: no special assumption

    Parallel associative join: one relation is declustered on joinattribute and equi-join

    Parallel hash join: equi-join

    I They also apply to other complex operatorssuch as duplicate elimination, union,

    intersection, etc. with minor adaptation

  • 8/9/2019 Distirbuted DataBase -Parallel

    33/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.33

    Parallel Nested Loop Join

    R S=i=1,n(R Si)

    sendpartition

    node 3 node 4

    node 1 node 2

    R1:

    S1 S2

    R2:

  • 8/9/2019 Distirbuted DataBase -Parallel

    34/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.34

    Parallel Associative Join

    node 1

    node 3 node 4

    node 2

    R1: R2:

    R S i=1,n(Ri Si)

    S1 S2

  • 8/9/2019 Distirbuted DataBase -Parallel

    35/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.35

    Parallel Hash Join

    R S i=1,P(Ri Si)

    node node node node

    node 1 node 2

    R1: R2: S1: S2:

  • 8/9/2019 Distirbuted DataBase -Parallel

    36/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.36

    Parallel Query Optimization

    The objective is to select the "best" parallelexecution plan for a query using the followingcomponents

    Search space Models alternative execution plans as operator trees Left-deep vs. Right-deep vs. Bushy trees

    Search strategy Dynamic programming for small search space Randomized for large search space

    Cost model (abstraction of execution system) Physical schema info. (partitioning, indexes, etc.) Statistics and cost functions

  • 8/9/2019 Distirbuted DataBase -Parallel

    37/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.37

    Execution Plans as Operators Trees

    R2R1

    R4

    Result

    j2

    j3

    Left-deep Right-deep

    j1 R3

    R2R1

    R4

    Result

    j5

    j6

    j4R3

    R2R1

    R3j7

    R4

    Result

    j9

    Zig-zagBushyj8

    Result

    j10

    j12

    j11

    R2R1 R4R3

  • 8/9/2019 Distirbuted DataBase -Parallel

    38/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.38

    Equivalent Hash-Join Trees

    with Different Scheduling

    R3

    Probe3Build3

    R4

    Temp2

    Temp1

    Build3

    R4

    Temp2

    Probe3Build3

    Probe2Build2

    Probe1Build1

    R2R1

    R3

    Temp1

    Probe2Build2

    Probe1Build1

    R2R1

  • 8/9/2019 Distirbuted DataBase -Parallel

    39/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.39

    Load Balancing

    I Problems arise for intra-operator parallelismwith skewed data distributionsattribute data skew (AVS)

    tuple placement skew (TPS)

    selectivity skew (SS)

    redistribution skew (RS)

    join product skew (JPS)

    I Solutions sophisticated parallel algorithms that deal with skew

    dynamic processor allocation (at execution time)

  • 8/9/2019 Distirbuted DataBase -Parallel

    40/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.40

    Data Skew Example

    Join1

    Res1Res2

    Join2AVS/TPS

    AVS/TPS

    AVS/TPS

    AVS/TPS

    JPSJPS

    RS/SS RS/SS

    Scan1 Scan2

    S2

    R2

    S1

    R1

  • 8/9/2019 Distirbuted DataBase -Parallel

    41/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.41

    I PrototypesEDS and DBS3 (ESPRIT)

    Gamma (U. of Wisconsin)

    Bubba (MCC, Austin, Texas)

    XPRS (U. of Berkeley)

    GRACE (U. of Tokyo)

    I ProductsTeradata (NCR)

    NonStopSQL (Tandem-Compac)

    DB2 (IBM), Oracle, Informix, Ingres, Navigator(Sybase) ...

    Some Parallel DBMSs

  • 8/9/2019 Distirbuted DataBase -Parallel

    42/42

    Distributed DBMS 1998 M. Tamer zsu & Patrick Valduriez Page 13.42

    I Hybrid architectures

    I OS support:using micro-kernels

    I Benchmarks to stress speedup and scaleup undermixed workloads

    I Data placement to deal with skewed data

    distributions and data replicationI Parallel data languages to specify independent

    and pipelined parallelism

    I Parallel query optimization to deal with mix of

    precompiled queries and complex ad-hoc queriesI Support of higher functionality such as rules and

    objects

    Open Research Problems