transactions in distributed systems
DESCRIPTION
Transactions in Distributed Systems. Slower to access information from remote node. Partial crashes in the system. Problems with message transmissions. Access of local information is much faster. Total Crashes. Distributed vs. Local Systems. What is a transaction?. - PowerPoint PPT PresentationTRANSCRIPT
04/25/23 1
Transactions in Distributed Transactions in Distributed SystemsSystems
04/25/23 2
Distributed vs. Local SystemsDistributed vs. Local Systems
Slower to access information from remote node.
Partial crashes in the system.
Problems with message transmissions.
Access of local information is much faster.
Total Crashes.
04/25/23 3
What is a transaction?What is a transaction? In databases, a transaction is “a collection of
operations that represent a unit of consistency and recovery”
Overall view of a transaction:– Initialization. (Memory, resources etc.)– Reads and modifications to consistent resource
objects.– Abort: Changes are undone and not saved and
resources are released – Commit: Changes are saved and resources are
released. Resources and information remain consistent.
04/25/23 4
Distributed TransactionsDistributed Transactions
Problem and solution ideas are very similar to the ones in transactions of database systems.
Solutions such as Concurrency, Atomicity and Recovery of transactions.
Additional problems in distributed transactions due to the reliance on network communication.
04/25/23 5
Problems with Distributed Problems with Distributed TransactionsTransactions1. Concurrency control of
transactions2. Inconsistencies due to Failures3. Recovery from System Crashes Presented solutions: Argus,
QuickSilver, RVM
04/25/23 6
Concurrency SolutionConcurrency Solution
Use of read and write locks to synchronize the access or modification of system resources.
A two-phase lock mechanism to allow full seriability.
04/25/23 7
Inconsistent system states due to Inconsistent system states due to FailuresFailuresThis is solved having atomicity of
operations.An operation can either commit or
abort.
04/25/23 8
Solution to RecoverySolution to Recovery
Save useful data of a transaction in stable storage.
Have a mechanism to bring back the whole system to a consistent state before continuing the transaction or abort the transaction.
04/25/23 9
Committing a transactionCommitting a transaction
Have mechanism to ensure that all operations, remote or local, commit or abort at “near” the same time when transaction commits.
Making sure that after transaction commit the entire system remains consistent.
04/25/23 10
ArgusArgus -Barbara Liskov et al.-Barbara Liskov et al.
A programming language and System for Distributed Programs
Intended for programs that keep online data for long periods of time
Guardians provide nice encapsulation of objects and resources.
Actions allow atomicity of processes
04/25/23 11
AssumptionsAssumptionsNodes can communicate only the
exchange of messages.It is impossible for a failed node to
send messages.Messages may be lost, delayed or
out of order.Corruption in messages are
detectable.
04/25/23 12
GuardiansGuardians Object that encapsulates resources in the
system. Resides in a single node and each node can
have more than one guardian. Resources are accessed through
handlers(location independent). Guardians can create other Guardians at the
specified node. Contains stable objects and volatile objects.
04/25/23 13
Printer GuardianPrinter Guardian
04/25/23 14
Atomic Actions (Actions)Atomic Actions (Actions) Actions are total, either it commits or
aborts(using atomic objects). Actions can be nested(actions &
subactions). When action commits it propagates its
locks and the object versions of the local guardian to the parent action.
The p-list (participating guardians of committed descendents) propagate to the parent.
04/25/23 15
Actions are SerializableActions are Serializable
Strict two-phase locking is used(locks are held until action commits or aborts).
Can prove that using a strict two-phase lock mechanism implies seriability of actions.
04/25/23 16
Action TreeAction Tree
A .1 .1@ G 3com m itted
A .1 .2@ G 4com m itted
A .1@ G 1aborted
A .2 .1@ G 3com m itted
A .2 .2@ G 5com m itted
A .2 .3@ G 6aborted
A .2@ G 2com m itted
A@ Gac tive
04/25/23 17
Concurrency Control SolutionConcurrency Control Solution
Synchronization access to resources is done via locks.
Every operation is a read or a write.Seriability, totality and
synchronization of actions to shared objects.
04/25/23 18
Locks in Nested Transactions Locks in Nested Transactions - J. Eliot B. Moss- J. Eliot B. Moss
“An action can acquire a read lock iff all holders of write locks are ancestors”
“It can acquire a write lock iff all holders of read or write locks are ancestors”
04/25/23 19
InconsistenciesInconsistencies
Inconsistencies are solved via the totality of actions.
An action can either commit or abort.
04/25/23 20
Recovery from CrashesRecovery from Crashes
Solved by the atomicity of actions and by using versions of the stable objects.
Versions are passed up the action tree when action commits.
04/25/23 21
Two-Phase Commit Protocol (I)Two-Phase Commit Protocol (I) Topaction guardian sends “prepare” messages to
guardian participants in the transaction. Participants receive message, records versions of
the objects modified by the descendents and a “prepare” record is saved in stable storage. Read locks are released.
Participants replies with an “ok” message. If some participant can’t save the necessary
information it sends a “refuse” message. If topaction receives any refused response or does
not respond, it aborts the transaction and “abort” messages are sent.
04/25/23 22
Two-Phase Commit Protocol (II)Two-Phase Commit Protocol (II) If every participant replies “ok”, topaction
guardian writes a committed record and sends “commit” messages to participants.
Participant writes a commit record, updates new versions of the objects, releases locks and sends a “done” message.
Topaction guardian saves a record after all participants have acknowledge.
2Phase Commit Protocol makes sure that the transaction either commits or aborts.
04/25/23 23
Data on Action Commits and Data on Action Commits and AbortsAborts
04/25/23 24
Timing of TopactionsTiming of Topactions
04/25/23 25
QuickSilver QuickSilver -Schmuck & Wyllie-Schmuck & Wyllie
Operating system that supports atomicity, recoverability and concurrency of transactions.
Flexible Concurrency control policy, each node can have its own policy.
Transaction commit is done via one-phase or two-phase commit protocol depending on the node.
No nested transactions.
04/25/23 26
Transaction ManagementTransaction Management
It is made up of three main pieces.1. Transaction Manager.2. Transactional IPC.3. A log manager.
04/25/23 27
Transaction ManagerTransaction ManagerTransaction Manager handles the
coordination of a transaction, from start to finish.
TM starts a transaction when it receives an IPC request from a process.
TM assigns globally unique TID and registers it with the kernel.
04/25/23 28
Transactional IPCTransactional IPC
IPC are done on behalf of a transaction. A participant of a transaction is either a
process that created the transaction or a process that received a request with an TID.
Remote requests are handled by the local Communication Manager process (CM).
04/25/23 29
Log ManagerLog Manager
Records appended at the end of a file.
Uses log to recover during the two-phase commit protocol.
LM may be used as checkpoints in long running computations.
04/25/23 30
ConcurrencyConcurrency QuickSilver allows each node to have it’s own
concurrency control policy. DFS does not enforce full seriability(improves
performance). Write locks obtained only when directory is
renamed, created or deleted. Reads lock are not required when reading a
directory. Read locks on files are released when file is closed. Write locks on files are released until transaction
commits.
04/25/23 31
RecoveryRecovery
Recovery is handled by the QuickSilver distributed file system (DFS).
Guarantees changes are saved on commit and it undoes any changes on abort.
04/25/23 32
Transaction CommitTransaction Commit TM collects information about all the
participants from the kernel. If CM is a participant, TM asks for list of
machines who received a request. TM requests all remote machines to
recursively commit. Any communication or machine failures
detected by CM causes an abort in the transaction.
04/25/23 33
Comparing AIX and QuickSilverComparing AIX and QuickSilver
04/25/23 34
Recoverable Virtual Memory Recoverable Virtual Memory Satyanarayanan et al.Satyanarayanan et al.
Only addresses the problem of Recovery. Stores Virtual memory in external data
segments found in stable storage. Portable with a library that is linked in with
applications. “Value simplicity over generality” by
adopting a layered approach. Provides independent control over atomicity
and concurrency as well as other problems such as deadlocks and starvations.
04/25/23 35
Layered Approach of RVMLayered Approach of RVM
04/25/23 36
Segments and RegionsSegments and Regions
Applications map regions of segments into their virtual memory.
04/25/23 37
Sequence of OperationsSequence of Operations
Select regions in virtual memory to be mapped.
Get a global transaction ID.Successful commit saves segments
in log.
04/25/23 38
Crash RecoveryCrash Recovery
Recovery consists of reading the log from tail to head and then reconstructing the last committed changes.
Modifications are applied to the external data segment.
Log is emptied.
04/25/23 39
TruncationTruncation
Reclaiming space in the log by applying changes to the external data segment.
Necessary because space is finite.
04/25/23 40
In SummaryIn Summary Argus provides a complete solution with
atomicity, concurrency control and recovery. However, it is too complex, slow and
unoptimized. QuickSilver shifts the problem of concurrency
control to the individual nodes and performs as good as AIX.
RVM addresses only the problem of recovery in VM and introduces a “neat” layered structure to address the other problems.