Professional Documents
Culture Documents
• Agenda
– The problem domain of design parallel & distributed
databases (chp 18-20)
– The data allocation problem
– The data processing algorithms
Parallel & Distributed databases
Application Application
Distributed control
Application
DBMS DBMS
DBMS
Hardware Hardware
Hardware
Distributed services
• 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
• Lock manager process
– Reduce lock-contention,
– Spin-locks/ semaphores
• Database writer process
– Output modified buffer blocks to
disks continually
Data Servers
• Data servers appear as a distributed DBMS that exchanges low-level
objects, e.g. pages
• 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 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.
• Issues:
– Page-Shipping versus Item-Shipping
– Locking
– Data Caching
– Lock Caching
Data Servers (Cont.)
• Page-Shipping versus Item-Shipping
– 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 called back by the server, and
returned by client transaction if the prefetched item has not been
used.
– Locks on the page can be deescalated to locks on items in the
page when there are lock conflicts. Locks on unused items can
then be returned to server.
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 deescalation, but across transactions.
Database Cache Servers
• Issues:
– SQL cache coherency
– Transaction management
– Optimization over materialized results
Parallel Systems
• Parallel database systems consist of multiple processors and multiple
disks connected by a fast interconnection network.
• Advantages of Replication
– Availability: failure of site containing relation r does not result in
unavailability of r if replicas exist.
– Parallelism: queries on r may be processed by several nodes in parallel.
– Reduced data transfer: relation r is available locally at each site
containing a replica of r.
• Disadvantages of Replication
– Increased cost of updates: each replica of relation r must be updated.
– Increased complexity of concurrency control: concurrent updates to
distinct replicas may lead to inconsistent data unless special
concurrency control mechanisms are implemented.
• One solution: choose one copy as primary copy and apply
concurrency control operations on primary copy
Distributed Data Storage
• Fragmentation
– Relation is partitioned into several fragments stored in distinct sites
3.Locating all tuples such that the value of a given attribute lies within
a specified range – range queries.
– E.g., 10 r.A < 25.
Comparison of Partitioning Techniques (Cont.)
Round robin:
• Advantages
– Best suited for sequential scan of entire relation on each query.
– All disks have almost an equal number of tuples; retrieval work is
thus well balanced between disks.
Hash partitioning:
• Good for sequential access
– Assuming hash function is good, and partitioning attributes form a
key, tuples will be equally distributed between disks
– Retrieval work is then well balanced between disks.
• Good for point queries on partitioning attribute
– Can lookup single disk, leaving others available for answering
other queries.
– Index on partitioning attribute can be local to disk, making lookup
and update more efficient
• No clustering, so difficult to answer range queries
Comparison of Partitioning Techniques (Cont.)
Range partitioning:
• Provides data clustering by partitioning attribute value.
• Good for sequential access
• Good for point queries on partitioning attribute: only one disk needs to
be accessed.
• For range queries on partitioning attribute, one to a few disks may need
to be accessed
• If a relation contains only a few tuples which will fit into a single disk
block, then assign the relation to a single disk.
• Large relations are preferably partitioned across all the available disks.
• Basic idea:
– If any normal partition would have been skewed, it is very likely
the skew is spread over a number of virtual partitions
– Skewed virtual partitions get spread across a number of
processors, so work gets distributed evenly!