Chapter 20: Database System Architectures
Chapter 20: Database System Architectures
Database System Concepts - 7th Edition 20.2 ©Silberschatz, Korth and Sudarshan
Centralized Database Systems
Database System Concepts - 7th Edition 20.3 ©Silberschatz, Korth and Sudarshan
Server System Architecture
Database System Concepts - 7th Edition 20.4 ©Silberschatz, Korth and Sudarshan
Transaction Servers
Database System Concepts - 7th Edition 20.5 ©Silberschatz, Korth and Sudarshan
Transaction System Processes (Cont.)
Database System Concepts - 7th Edition 20.6 ©Silberschatz, Korth and Sudarshan
Transaction Server Process Structure
Database System Concepts - 7th Edition 20.7 ©Silberschatz, Korth and Sudarshan
Transaction Server Processes (Cont.)
Database System Concepts - 7th Edition 20.8 ©Silberschatz, Korth and Sudarshan
Transaction System Processes (Cont.)
Database System Concepts - 7th Edition 20.9 ©Silberschatz, Korth and Sudarshan
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
Database System Concepts - 7th Edition 20.10 ©Silberschatz, Korth and Sudarshan
Data Servers/Data Storage Systems
Database System Concepts - 7th Edition 20.11 ©Silberschatz, Korth and Sudarshan
Data Servers/Storage Systems (Cont.)
Prefetching
• Prefetch items that may be used soon
Data caching
• Cache coherence
Lock caching
• Locks can be cached by client across transactions
• Locks can be called back by the server
Adaptive lock granularity
• Lock granularity escalation
switch from finer granularity (e.g. tuple) lock to coarser
• Lock granularity de-escalation
Start with coarse granularity to reduve overheads, switch to finer
granularity in case of more concurrency conflict at server
Details in book
Database System Concepts - 7th Edition 20.12 ©Silberschatz, Korth and Sudarshan
Data Servers (Cont.)
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 lock callback on prefetch, but across transactions.
Database System Concepts - 7th Edition 20.13 ©Silberschatz, Korth and Sudarshan
Parallel Systems
Database System Concepts - 7th Edition 20.14 ©Silberschatz, Korth and Sudarshan
Parallel Systems (Cont.)
Database System Concepts - 7th Edition 20.15 ©Silberschatz, Korth and Sudarshan
Speed-Up and Scale-Up
Database System Concepts - 7th Edition 20.16 ©Silberschatz, Korth and Sudarshan
Speedup
Database System Concepts - 7th Edition 20.17 ©Silberschatz, Korth and Sudarshan
Scaleup
Database System Concepts - 7th Edition 20.18 ©Silberschatz, Korth and Sudarshan
Batch and Transaction Scaleup
Batch scaleup:
• A single large job; typical of most decision support queries and
scientific simulation.
• Use an N-times larger computer on N-times larger problem.
Transaction scaleup:
• Numerous small queries submitted by independent users to a shared
database; typical transaction processing and timesharing systems.
• N-times as many users submitting requests (hence, N-times as many
requests) to an N-times larger database, on an N-times larger
computer.
• Well-suited to parallel execution.
Database System Concepts - 7th Edition 20.19 ©Silberschatz, Korth and Sudarshan
Factors Limiting Speedup and Scaleup
Database System Concepts - 7th Edition 20.20 ©Silberschatz, Korth and Sudarshan
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 2n 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
each other via at most log(n) links; reduces communication delays.
Tree-like Topology. Widely used in data centers today
Database System Concepts - 7th Edition 20.21 ©Silberschatz, Korth and Sudarshan
Interconnection Architectures
Database System Concepts - 7th Edition 20.22 ©Silberschatz, Korth and Sudarshan
Interconnection Network Architectures
Tree-like or Fat-Tree Topology: widely used in data centers today
• Top of rack switch for approx 40 machines in rack
• Each top of rack switch connected to multiple aggregation switches.
• Aggregation switches connect to multiple core switches.
Data center fabric
Database System Concepts - 7th Edition 20.23 ©Silberschatz, Korth and Sudarshan
Network Technologies
Ethernet
• 1 Gbps and 10 Gbps common, 40 Gbps and 100 Gbps are available
at higher cost
Fiber Channel
• 32-138 Gbps available
Infiniband
• a very-low-latency networking technology
0.5 to 0.7 microseconds, compared to a few microseconds for
optimized ethernet
Database System Concepts - 7th Edition 20.24 ©Silberschatz, Korth and Sudarshan
Parallel Database Architectures
Database System Concepts - 7th Edition 20.25 ©Silberschatz, Korth and Sudarshan
Shared Memory
Database System Concepts - 7th Edition 20.26 ©Silberschatz, Korth and Sudarshan
Modern Shared Memory Architecture
Database System Concepts - 7th Edition 20.27 ©Silberschatz, Korth and Sudarshan
Cache Levels
Shared memory system can have multiple processors, each with its own
cache levels
Database System Concepts - 7th Edition 20.28 ©Silberschatz, Korth and Sudarshan
Cache Coherency
Cache coherency:
• Local cache may have out of date value
• Strong vs weak consistency models
• With weak consistency, need special instructions to ensure cache is up
to date
Memory barrier instructions
• Store barrier (sfence)
Instruction returns after forcing cached data to be written to memory
and invalidations sent to all caches
• Load barrier (lfence)
Returns after ensuring all pending cache invalidations are
processed
• mfence instruction does both of above
Locking code usually takes care of barrier instructions
• Lfence done after lock acquisition and sfence done before lock release
Database System Concepts - 7th Edition 20.29 ©Silberschatz, Korth and Sudarshan
Shared Disk
Database System Concepts - 7th Edition 20.30 ©Silberschatz, Korth and Sudarshan
Modern Shared Disk Architectures:
via Storage Area Network (SAN)
Database System Concepts - 7th Edition 20.31 ©Silberschatz, Korth and Sudarshan
Shared Nothing
Database System Concepts - 7th Edition 20.32 ©Silberschatz, Korth and Sudarshan
Hierarchical
Database System Concepts - 7th Edition 20.33 ©Silberschatz, Korth and Sudarshan
Shared-Memory Vs Shared-Nothing
Database System Concepts - 7th Edition 20.34 ©Silberschatz, Korth and Sudarshan
Distributed Systems
netw ork
communication
via network
site B
Database System Concepts - 7th Edition 20.35 ©Silberschatz, Korth and Sudarshan
Distributed Databases
Database System Concepts - 7th Edition 20.36 ©Silberschatz, Korth and Sudarshan
Data Integration and Distributed Databases
Data integration between multiple distributed databases
Benefits:
• Sharing data – users at one site able to access the data residing at
some other sites.
• Autonomy – each site is able to retain a degree of control over data
stored locally.
Database System Concepts - 7th Edition 20.37 ©Silberschatz, Korth and Sudarshan
Availability
Network partitioning
Availability of system
• If all nodes are required for system to function, failure of even one
node stops system functioning.
• Higher system availability through redundancy
data can be replicated at remote sites, and system can function
even if a site fails.
Database System Concepts - 7th Edition 20.38 ©Silberschatz, Korth and Sudarshan
Implementation Issues for Distributed
Databases
Atomicity needed even for transactions that update data at multiple sites
The two-phase commit protocol (2PC) is used to ensure atomicity
• Basic idea: each site executes transaction until just before commit, and
the leaves final decision to a coordinator
• Each site must follow decision of coordinator, even if there is a failure
while waiting for coordinators decision
2PC is not always appropriate: other transaction models based on
persistent messaging, and workflows, are also used
Distributed concurrency control (and deadlock detection) required
Data items may be replicated to improve data availability
Details of all above in Chapter 24
Database System Concepts - 7th Edition 20.39 ©Silberschatz, Korth and Sudarshan
Cloud Based Services
Database System Concepts - 7th Edition 20.40 ©Silberschatz, Korth and Sudarshan
Cloud Service Models
Database System Concepts - 7th Edition 20.41 ©Silberschatz, Korth and Sudarshan
Application Deployment Alternatives
Database System Concepts - 7th Edition 20.42 ©Silberschatz, Korth and Sudarshan
Application Deployment Architectures
Services
Microservice Architecture
• Application uses a variety of services
• Service can add or remove instances as required
Kubernetes supports containers, and microservices
Database System Concepts - 7th Edition 20.43 ©Silberschatz, Korth and Sudarshan
End of Chapter 20
Database System Concepts - 7th Edition 20.45 ©Silberschatz, Korth and Sudarshan