Database System Architectures Centralized Systems Course outlines ClientServer

Database System Architectures Centralized Systems Course outlines Client-Server Systems Transaction Servers Data Servers Parallel DBMS Interconnection Network Architectures Architecture Issue: Shared What? Parallel DBMS Techniques and different Types Data Partitioning Parallel processing

Database System Architectures - Centralized Systems Ê Run on a single computer system and do not interact with other computer systems. Ê General-purpose computer system Ê one to a few CPUs Ê and a number of device controllers Ê that are connected through a common bus Ê that provides access to shared memory. A Centralized Computer System Ê Single-user system (e. g. , personal computer or workstation) Ê desk-top unit, single user, Ê usually has only one CPU and one or two hard disks; Ê the OS may support only one user. Ê Multi-user system Ê more disks, more memory, multiple CPUs, and a multi-user OS. Ê Serve a large number of users who are connected to the system via terminals. 2

Database System Architectures – Client / Server Systems Client-Server Systems (1/2) Server systems satisfy requests generated at n client systems, whose general structure is enclosed. 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 3

Database System Architectures – Client / Server Systems Client-Server Systems (2/2) A Advantages of replacing mainframes with networks of workstations or personal computers connected to back-end server machines: Ê better functionality for the cost Ê flexibility in locating resources and expanding facilities Ê better user interfaces Ê easier maintenance Server System Architecture - Server systems can be broadly categorized into two kinds: Êtransaction servers which are widely used in relational database systems, and Êdata servers, used in object-oriented database systems 4

Database System Architectures – C/S Systems Trans. Servers Transaction Servers Ê Also called Query server systems or SQL server systems; clients send requests to the server system where the transactions are executed, and results are shipped back to the client. Ê Requests specified in SQL, and communicated to the server through a remote procedure call (RPC) mechanism. Ê Open Database Connectivity (ODBC) is a C language application program interface standard from Microsoft for connecting to a server, sending SQL requests, and receiving results. 5

Database System Architectures – C/S Systems Trans. Servers Transaction Server Process Structure (1/2) A typical transaction server consists of multiple processes accessing data in shared memory. Server processes Ê These receive user queries (transactions), execute them and send results back Ê Processes may be multithreaded, allowing a single process to execute several user queries concurrently Ê Typically multiple multithreaded server processes Ê Lock manager process Ê Database writer process - Output modified buffer blocks to disks continually Ê Log writer process Ê Server processes simply add log records to log record buffer Ê Log writer process outputs log records to stable storage. Ê Checkpoint process - Performs periodic checkpoints Ê Process monitor process - Monitors other processes, and takes recovery 6

Database System Architectures – C/S Systems Trans. Servers Transaction Server Process Structure (2/2) Shared memory contains shared data Ê Buffer pool , Log buffer Ê Lock table , Cached query plans (reused if same query submitted again) Ê All database processes can access shared memory Ê To ensure that no two processes are accessing the same data structure at the same time, databases systems implement mutual exclusion using either Ê Operating system semaphores Ê Atomic instructions such as test-and-set Ê To avoid overhead of interprocess communication for lock request/grant, each database process operates directly on the lock table 7

Database System Architectures – C/S Systems Data Servers (1/2) Used in LANs, where there is a very high speed connection between the clients and the server Êthe client machines are comparable in processing power to the server machine, Êand the tasks to be executed are compute intensive. Ê Ship data to client machines where processing is performed, and then ship results back to the server machine. Ê This architecture requires full back-end functionality at the clients. Ê Used in many object-oriented database systems e. g. : Object. Store Issues: ÊPage-Shipping versus Item-Shipping 8

Database System Architectures – C/S Systems Data Servers (2/2) Page-shipping vs. itemshipping Ê Smaller unit of shipping more messages Ê Worth prefetching related items along with requested item Ê Page shipping can be thought of as a form of prefetching Locking Ê Overhead of requesting and getting locks from server is high due to message delays Ê Can grant locks on requested and prefetched items; with page shipping, transaction is granted lock on whole page. Ê Locks on a prefetched item can be P{called back} by the server, and returned by client transaction if the prefetched item has not been used. Data Caching Ê Data can be cached at client even in between transactions Ê But check that data is up-to-date before it is used (cache coherency) Ê Check can be done when requesting lock on data item Lock Caching Ê Locks can be retained by client system even in between transactions Ê Transactions can acquire cached locks locally, without contacting server Ê Server calls back locks from clients when it receives conflicting lock request. Client returns lock once no local transaction is using it. Ê Similar to deescalation, but across 9 transactions.

Parallel DBMS Overview Why Parallel Access To Data? Parallel database Systems Interconnection Network Architectures Architecture Issue: Shared What? Parallel DBMS Techniques Different Types of DBMS ||-ism Data Partitioning Parallel processing Parallel DBMS Summary

Parallel DBMS Overview Why Parallel Access To Data? Bandwidth? 10 MB/s 1 Terabyte = 1 M MB At 10 MB/s 1, 000 x parallel 1. 5 minute to scan. 1. 2 days to scan Parallelism: divide a big problem into many smaller ones to be solved in parallel. 11

Parallel DBMS Overview Introduction Parallelism is natural to DBMS processing Ê Pipeline parallelism: many machines each doing one step in a multi-step process. Pipeline Any Sequential Program Ê Partition parallelism: many machines doing the same thing to different pieces of data. Partition Sequential Any Sequential Program outputs split N ways, inputs merge M ways Ê Both are natural in DBMS! 12

Parallel DBMS Overview DBMS: The || Success Story DBMSs are the most (only? ) successful application of parallelism. ÊTeradata, Tandem vs. Thinking Machines, KSR. . ÊEvery major DBMS vendor has some || server ÊWorkstation manufacturers now depend on || DB server sales. Reasons for success: ÊBulk-processing (= partition ||-ism). ÊNatural pipelining. ÊInexpensive hardware can do the trick! ÊUsers/app-programmers don’t need to think in || 13

Parallel DBMS Overview Speed-Up More resources means proportionally less time for given amount of data. Xact/sec. (throughput) Some || Terminology Ideal Scale-Up sec. /Xact (response time) degree of ||-ism If resources increased in proportion to increase in data size, time is constant. Ideal degree of ||-ism 14

Parallel DBMS Overview Parallel database 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 processors Ê A 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 interval Ê Response time: the amount of time it takes to complete a single task from the time it is submitted 15

Parallel DBMS Overview Interconnection Network Architectures Bus. System components send data on and receive data from a single communication bus; Does not scale well with increasing parallelism. Mesh. Components are arranged as nodes in a grid, and each component is connected to all adjacent components Ê Communication links grow with growing number of components, and so scales better. Ê But may require 2 n hops to send message to a node (or n with wraparound connections at edge of grid). Hypercube. Components are numbered in binary; components are connected to one another if their binary representations differ in exactly one bit. n components are connected to log(n) other components and can reach other via at most log(n) links; reduces 16

Parallel DBMS - Parallel Database Architectures Architecture Issue: Shared What? a. Shared memory -- processors share a common memory b. Shared disk -- processors share a common disk c. Shared nothing -- processors share neither a common memory d. Hierarchical -- hybrid of the above architectures nor common disk Easy to program Expensive to build Hard to program Cheap to build 17

Parallel DBMS - Parallel Database Architectures What Systems Work This (as Way of 9/1995) Shared Nothing Teradata: 400 nodes Tandem: 110 nodes IBM / SP 2 / DB 2: 128 nodes Informix/SP 2 48 nodes ATT & Sybase ? nodes Shared Disk Oracle DEC Rdb 170 nodes 24 nodes Shared Memory Informix Red. Brick 9 nodes ? nodes 18

Parallel DBMS - Parallel Database Architectures Shared Memory Processors and disks have access to a common memory, typically via a bus or through an interconnection network. A Extremely efficient communication between processors — data in shared memory can be accessed by any processor without having to move it using software. D Downside – architecture is not scalable beyond 32 or 64 processors since the bus or the interconnection network becomes a bottleneck O Widely used for lower degrees of parallelism (4 to 8). 19

Parallel DBMS - Parallel Database Architectures 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 bottleneck ÊArchitecture 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. 20

Parallel DBMS - Parallel Database Architectures 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 CUBE é Data 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. 21

Parallel DBMS - Parallel Database Architectures Hierarchical Combines good load balancing of SM with extensibility of SN Ê 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, Ê has much better cost-performance (cluster of workstations) Ê However, it 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. Ê Reduce the complexity of programming such systems by distributed 22 virtual-memory architectures

Parallel DBMS Techniques Data placement ÊPhysical placement of the DB onto multiple nodes ÊStatic vs. Dynamic Parallel data processing ÊSelect is easy ÊJoin (and all other non-select operations) is more difficult Parallel query optimization ÊChoice of the best parallel execution plans ÊAutomatic parallelization of the queries and load balancing Transaction management 23

Different Types of DBMS ||-ism Intra-operator parallelism get all machines working to compute a given operation (scan, sort, join) Inter-operator parallelism each operator may run concurrently on a different site (exploits pipelining) Inter-query parallelism different queries run on different sites 24

Partitioning Schemes Automatic Data Partitioning Each relation is divided in n partitions (subrelations), where n is a function of relation size and access frequency Partitioning a table: Range Hash Round Robin A. . . E F. . . J K. . . N O. . . S T. . . Z Good for equijoins, range queries group -by Good for equijoins Good to spread load Shared disk and memory less sensitive to partitioning, 25

Parallel processing – rapid overview Parallel Scanning/Sorting Parallel Scans Ê Scan in parallel, and merge. Ê Selection may not require all sites for range or hash partitioning. Ê Indexes can be built at each partition. Question: How do indexes differ in the different schemes? Ê Think about both lookups and inserts! Ê What about unique indexes? Parallel Sorting Ê Scan in parallel, and range-partition as you go. Ê As tuples come in, begin “local” sorting on each Ê Resulting data is sorted, and range-partitioned. Problem: skew! Solution: “sample” the data at start to determine partition points. 26

Parallel processing – rapid overview Parallel Aggregates For each aggregate function, need a decomposition: count(S) = S count(s(i)) sum() avg(S) = (S sum(s(i))) / S count(s(i)) and so on. . . idem for For groups: Sub-aggregate groups close to the source. Pass each sub-aggregate to its group’s site. Chosen via a hash function. 27

Parallel processing – rapid overview Parallel Join Processing Three basic algorithms for intraoperator parallelism Ê Parallel nested loop join: no special assumption Ê Parallel associative join: one relation is declustered on join attribute and equi-join Ê Parallel hash join: equi-join Parallel nested loop join Parallel hash join They also apply to other complex operators such as duplicate elimination, union, intersection, etc. with minor adaptation Parallel associative join 28

Parallel processing – rapid overview Complex Parallel Query Plans Complex Queries: Inter-Operator parallelism Ê Pipelining between operators: note that sort and phase 1 of hash-join block the pipeline!! Ê Bushy Trees Sites 1 -8 Sites 5 -8 A B R S Sites 1 -4 Parallel Query Optimization Ê Common approach: 2 phases ÊPick best sequential plan ÊPick degree of parallelism based on current system parameters. Ê “Bind” operators to processors ÊTake query tree, “decorate” as in previous picture. 29

Parallel processing – rapid overview Parallel Query Optimization The objective is to select the "best" parallel execution plan for a query using the following components 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. ) 30

Parallel DBMS Summary Ê ||-ism natural to query processing: Ê Both pipeline and partition ||ism! Ê Shared-Nothing vs. Shared. Mem Ê Shared-disk too, but less standard Ê Shared-mem easy, costly. Doesn’t scaleup. Ê Shared-nothing cheap, scales well, harder to implement. Ê Intra-op, Inter-op, & Interquery ||-ism all possible. Ê Data layout choices important! Ê Most DB operations can be done partition-|| Ê Complex plans. Ê Allow for pipeline-||ism, but sorts, hashes block the pipeline. Ê Partition ||-ism acheived via bushy trees Ê Hardest part of the equation: optimization. Ê 2 -phase optimization simplest, but can be ineffective. Ê More complex schemes still at the research stage. Ê We haven’t said anything about Xacts, logging. Ê Easy in shared-memory architecture. Ê Takes some care in shared- 31
- Slides: 31