Slide 4
Slide 4
(MSITec7111)
Parallel Systems
Distributed Systems
Centralized Database Systems
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
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.
Parallel Systems
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.
Factors Limiting Speedup and Scaleup
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
Interconnection Architectures
Interconnection Network Architectures
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
Parallel Database Architectures
Shared Memory
Shared memory system can have multiple processors, each with its own
cache levels
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
Shared Disk
network
communication
via network
site B
Distributed Databases
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.
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
Cloud Based Services
Services
Microservice Architecture
• Application uses a variety of services
• Service can add or remove instances as required
Kubernetes supports containers, and microservices