Outline Centralized Database Systems Server System Architectures Parallel Systems ■ Distributed Systems Network Types Database System Concepts-7th Edition 20.2 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 20.2 ©Silberschatz, Korth and Sudarshan th Edition Outline ▪ Centralized Database Systems ▪ Server System Architectures ▪ Parallel Systems ▪ Distributed Systems ▪ Network Types
Centralized Database Systems Run on a single computer system ■Single-user system ·Embedded databases Multi-user systems also known as server systems. Service requests received from client systems Multi-core systems with coarse-grained parallelism Typically a few to tens of processor cores In contrast,fine-grained parallelism uses very large number of computers Database System Concepts-7th Edition 20.3 @Silberschatz,Korth and Sudarshan
Database System Concepts - 7 20.3 ©Silberschatz, Korth and Sudarshan th Edition Centralized Database Systems ▪ Run on a single computer system ▪ Single-user system • Embedded databases ▪ Multi-user systems also known as server systems. • Service requests received from client systems • Multi-core systems with coarse-grained parallelism ▪ Typically a few to tens of processor cores ▪ In contrast, fine-grained parallelism uses very large number of computers
Server System Architecture Server systems can be broadly categorized into two kinds: ·transaction servers Widely used in relational database systems,and ·data servers Parallel data servers used to implement high-performance transaction processing systems Database System Concepts-7th Edition 20.4 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 20.4 ©Silberschatz, Korth and Sudarshan th Edition Server System Architecture ▪ Server systems can be broadly categorized into two kinds: • transaction servers ▪ Widely used in relational database systems, and • data servers ▪ Parallel data servers used to implement high-performance transaction processing systems
Transaction Servers Also called query server systems or SQL serversystems Clients send requests to the server Transactions are executed at the server Results are shipped back to the client. Requests are specified in SQL,and communicated to the server through a remote procedure call(RPC)mechanism. Transactional RPC allows many RPC calls to form a transaction. Applications typically use ODBC/JDBC APIs to communicate with transaction servers Database System Concepts-7th Edition 20.5 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 20.5 ©Silberschatz, Korth and Sudarshan th Edition Transaction Servers ▪ Also called query server systems or SQL server systems • Clients send requests to the server • Transactions are executed at the server • Results are shipped back to the client. ▪ Requests are specified in SQL, and communicated to the server through a remote procedure call (RPC) mechanism. ▪ Transactional RPC allows many RPC calls to form a transaction. ▪ Applications typically use ODBC/JDBC APIs to communicate with transaction servers
Transaction System Processes(Cont.) user user user process process process ODBC JDBC server server server process process process process buffer pool monitor shared process memory query plan cache lock log buffer lock table manager process database log writer checkpoint writer process process process log disks data disks Database System Concepts-7th Edition 20.6 @Silberschatz,Korth and Sudarshan
Database System Concepts - 7 20.6 ©Silberschatz, Korth and Sudarshan th Edition Transaction System Processes (Cont.)
Transaction Server Process Structure A typical transaction server consists of multiple processes accessing data in shared memory Shared memory contains shared data ·Buffer pool ·Lock table ·Log buffer Cached query plans (reused if same query submitted again) All database processes can access 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 Database System Concepts-7th Edition 20.7 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 20.7 ©Silberschatz, Korth and Sudarshan th Edition Transaction Server Process Structure ▪ A typical transaction server consists of multiple processes accessing data in shared memory ▪ Shared memory contains shared data • Buffer pool • Lock table • Log buffer • Cached query plans (reused if same query submitted again) ▪ All database processes can access 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
Transaction Server Processes (Cont.) 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 actions if any of the other processes fail E.g.aborting any transactions being executed by a server process and restarting it Database System Concepts-7th Edition 20.8 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 20.8 ©Silberschatz, Korth and Sudarshan th Edition Transaction Server Processes (Cont.) ▪ 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 actions if any of the other processes fail ▪ E.g. aborting any transactions being executed by a server process and restarting it
Transaction System Processes (Cont.) Lock manager process To avoid overhead of interprocess communication for lock request/grant,each database process operates directly on the lock table instead of sending requests to lock manager process Lock manager process still used for deadlock detection To ensure that no two processes are accessing the same data structure at the same time,databases systems implement mutual exclusion using either ·Atomic instructions Test-And-Set Compare-And-Swap(CAS) Operating system semaphores Higher overhead than atomic instructions Database System Concepts-7th Edition 20.9 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 20.9 ©Silberschatz, Korth and Sudarshan th Edition Transaction System Processes (Cont.) ▪ Lock manager process • To avoid overhead of interprocess communication for lock request/grant, each database process operates directly on the lock table ▪ instead of sending requests to lock manager process • Lock manager process still used for deadlock detection ▪ To ensure that no two processes are accessing the same data structure at the same time, databases systems implement mutual exclusion using either • Atomic instructions ▪ Test-And-Set ▪ Compare-And-Swap (CAS) • Operating system semaphores ▪ Higher overhead than atomic instructions
Atomic Instructions ■Test-And-SetM) Memory location M,initially 0 Test-and-set(M)sets M to 1,and returns old value of M Return value 0 indicates process has acquired the mutex Return value 1 indicates someone is already holding the mutex ·Must try again later Release of mutex done by setting M=0 Compare-and-swap(M,V1,V2) Atomically do following If M=V1,set M=V2 and return success Else return failure With M=0 initially,CAS(M,0,1)equivalent to test-and-set(M) Can use CAS(M,0,id)where id thread-id or process-id to record who has the mutex Database System Concepts-7th Edition 20.10 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 20.10 ©Silberschatz, Korth and Sudarshan th Edition Atomic Instructions ▪ Test-And-Set(M) • Memory location M, initially 0 • Test-and-set(M) sets M to 1, and returns old value of M ▪ Return value 0 indicates process has acquired the mutex ▪ Return value 1 indicates someone is already holding the mutex • Must try again later ▪ Release of mutex done by setting M = 0 ▪ Compare-and-swap(M, V1, V2) • Atomically do following ▪ If M = V1, set M = V2 and return success ▪ Else return failure • With M = 0 initially, CAS(M, 0, 1) equivalent to test-and-set(M) • Can use CAS(M, 0, id) where id = thread-id or process-id to record who has the mutex
Data Servers/Data Storage Systems m Data items are shipped to clients where processing is performed Updated data items written back to server Earlier generation of data servers would operated in units of data items, or pages containing multiple data items a Current generation data servers(also called data storage systems)only work in units of data items Commonly used data item formats include JSON,XML,or just uninterpreted binary strings Database System Concepts-7th Edition 20.11 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 20.11 ©Silberschatz, Korth and Sudarshan th Edition Data Servers/Data Storage Systems ▪ Data items are shipped to clients where processing is performed ▪ Updated data items written back to server ▪ Earlier generation of data servers would operated in units of data items, or pages containing multiple data items ▪ Current generation data servers (also called data storage systems) only work in units of data items • Commonly used data item formats include JSON, XML, or just uninterpreted binary strings