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
![Page 1: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/1.jpg)
04/25/23 1
Transactions in Distributed Transactions in Distributed SystemsSystems
![Page 2: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/2.jpg)
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.
![Page 3: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/3.jpg)
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.
![Page 4: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/4.jpg)
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.
![Page 5: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/5.jpg)
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
![Page 6: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/6.jpg)
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.
![Page 7: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/7.jpg)
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.
![Page 8: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/8.jpg)
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.
![Page 9: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/9.jpg)
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.
![Page 10: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/10.jpg)
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
![Page 11: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/11.jpg)
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.
![Page 12: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/12.jpg)
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.
![Page 13: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/13.jpg)
04/25/23 13
Printer GuardianPrinter Guardian
![Page 14: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/14.jpg)
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.
![Page 15: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/15.jpg)
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.
![Page 16: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/16.jpg)
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
![Page 17: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/17.jpg)
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.
![Page 18: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/18.jpg)
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”
![Page 19: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/19.jpg)
04/25/23 19
InconsistenciesInconsistencies
Inconsistencies are solved via the totality of actions.
An action can either commit or abort.
![Page 20: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/20.jpg)
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.
![Page 21: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/21.jpg)
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.
![Page 22: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/22.jpg)
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.
![Page 23: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/23.jpg)
04/25/23 23
Data on Action Commits and Data on Action Commits and AbortsAborts
![Page 24: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/24.jpg)
04/25/23 24
Timing of TopactionsTiming of Topactions
![Page 25: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/25.jpg)
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.
![Page 26: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/26.jpg)
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.
![Page 27: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/27.jpg)
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.
![Page 28: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/28.jpg)
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).
![Page 29: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/29.jpg)
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.
![Page 30: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/30.jpg)
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.
![Page 31: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/31.jpg)
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.
![Page 32: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/32.jpg)
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.
![Page 33: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/33.jpg)
04/25/23 33
Comparing AIX and QuickSilverComparing AIX and QuickSilver
![Page 34: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/34.jpg)
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.
![Page 35: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/35.jpg)
04/25/23 35
Layered Approach of RVMLayered Approach of RVM
![Page 36: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/36.jpg)
04/25/23 36
Segments and RegionsSegments and Regions
Applications map regions of segments into their virtual memory.
![Page 37: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/37.jpg)
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.
![Page 38: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/38.jpg)
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.
![Page 39: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/39.jpg)
04/25/23 39
TruncationTruncation
Reclaiming space in the log by applying changes to the external data segment.
Necessary because space is finite.
![Page 40: Transactions in Distributed Systems](https://reader031.vdocuments.site/reader031/viewer/2022020722/5681675d550346895ddc2b27/html5/thumbnails/40.jpg)
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.