Information Technology Reference
In-Depth Information
Isolation and concurrency revisited. Redo logging provides a mechanism
for atomically making multiple updates durable, but if there are concurrent
transactions operating on shared state, we must also ensure isolation| each
transaction must appear to operate on its own.
A common way to enforce isolation among transactions is two-phase locking ,
,Definition: two-phase
locking
which divides a transaction into two phases. During the expanding phase, locks
may be acquired but not released. Then, in the contracting phase, locks may be
released but not acquired. In the case of transactions, because we want isolation
and durability, the second phase must wait unti lafter the transaction commits
or rolls back so that no other transaction sees updates that later disappear.
Two phase locking ensures a strong form of isolation called serializability.
Serializablity across transactions ensures that the result of any execution of the
Denition: serializability
program is equivalent to an execution in which transactions are processed one at
a time in some sequential order. So, even if multiple transactions are executed
concurrently, they can only produce results that they could have produced had
they been executed one at a time in some order.
Although acquiring multiple locks in arbitrary orders normally risks dead-
lock, transactions provide a simple solution. If a set of transactions deadlocks,
one or more of the transactions can be forced to roll back, release their locks,
and restart at some later time.
Performance of redo logging. It might sound like redo logging will impose
a significant performance penalty compared to simply updating data in place:
redo logging writes each update twice|rst to the log and then to its nal
storage location.
Things are not as bad as they initially seem. Redo logging can have excellent
performance|often better than update in place|especially for small writes.
Four factors allow ecient implementations of redo logging:
Log updates are sequential. Because log updates are sequential, ap-
pending to the log is fast. With spinning disks, large numbers of updates
can be written as a sequential stream without seeks or rotational delay
once the write begins. Many high-performance systems dedicate a sepa-
rate disk for logging so that log appends never require a seek. For flash
storage, sequential updates are often significantly faster than random up-
dates, though the advantage is not as pronounced.
Writeback is asynchronous. Because writeback can be delayed until
some time after a transaction has been committed, transactions using
redo logs can have good response time (because the transaction commit
only requires appending a commit record to the log) and can have good
throughput (because batched writebacks can be scheduled more eciently
than individual or small groups of writes that must occur immediately.)
 
Search WWH ::




Custom Search