Download presentation
Presentation is loading. Please wait.
Published byBasil Fitzgerald Modified over 9 years ago
1
A Survey on Optimistic Concurrency Control CAI Yibo 1010087850 ZHENG Xin 1010121850
2
Outline Introduction OCC algorithm Three phases – Backward vs. Forward Validation OCC VS. 2PL Conclusion
3
Classification of concurrency control
4
Optimistic Concurrency Control Principle – transaction proceeds without checking conflict – validates its change prior to commit checking if data items have changed by committed transactions Three phases – Read Phase committed version of data items for read - read set tentative version of data items for write - write set – Validation Phase start with End Transaction request validate if data items have changed by other transactions if no conflicts, commit; otherwise, abort – Write phase make changes permanent
5
Validation Phase Validation rules – For a transaction T v to be serializable with respect to an overlapping transaction T i Validation mechanisms – Backward validation – Forward validation TvTv TiTi Rule writeread 1.T i must not read objects written by T v readwrite 1.T v must not read objects written by T i writeWrite 1.T i must not write objects written by T v and T v must not write objects written by T i
6
Backward Validation Algorithm – checks transaction in validation phase with other preceding overlapping transactions that have entered validation phase. – no check is needed for transaction with only Write operations since Read operations of earlier transactions are done already
7
Backward Validation
8
Forward Validation Algorithm – checks transaction in validation phase with other overlapping active transactions – no check is needed for transaction with only Read operations since later transactions do not write until it is done – other options than aborting the current transaction defer validation until conflicting transaction finished abort conflicting transaction instead
9
Forward Validation
10
Comparison of two validation Resolution of conflict – backward validation allows only one choice Abort the transaction being validated – forward validation allows flexible solutions Overhead (In general, number of read sets > number of write sets) – backward validation compares a possibly large read set against the old write sets overhead of storing old write sets – forward validation checks a small write set against the read sets of active transactions need to allow for new transactions starting during validation
11
Optimistic VS. Two-Phase Locking Distributed High-Performance Systems Hard Real-Time Systems – Maintain temporal consistency Real-Time Database Systems
12
In Distributed High-Performance Systems Improvement of OCC – Limit the number of repeated transaction restarts Primary Metric – Overall Transaction Throughput System Capacity – 100 MIPS – 200 MIPS – 400 MIPS
13
In Distributed High-Performance Systems
16
Distributed High-Performance Systems Generally, improved OCC outperforms 2PL, especially in systems with fast processors.
17
In Hard Real-Time Systems Hard-Real Time System – functional correctness – perform exactly no later than a deadline Temporal Consistency – Data objects are temporally consistent if their ages and dispersions are sufficiently small to meet the requirements of the application
18
In Hard Real-Time Systems
19
In Hard Real-Time Systems B represents for period ratio. B = longest period / shortest period. Each period will be in the interval [1, B].
20
In Hard Real-Time Systems five different conflict patterns – All transactions may conflict with each other. – 0.5 conflicts probability among transactions. – Locality of conflict, which means that the probability of conflicts among transactions with similar periods is 0.5 while the probability of conflicts among transactions with different periods is 0.2 – 0.2 conflicts probability among transactions. – No conflict at all.
21
In Hard Real-Time Systems Performance of 2PL for Different Conflict Patterns Performance of OCC for Different Conflict Patterns
22
In Hard Real-Time Systems Comparison Between OCC and 2PL When B = 10 Comparison Between OCC and 2PL When B = 50
23
In Hard Real-Time Systems 2PL outperforms OCC – under OCC transactions restarted due to access conflicts often do not have enough time to complete on time, leading temporally inconsistent data read by other transactions
24
In Real-Time Database Systems OCC generates higher deadline guarantee ratio than 2PL The performance is relative to the tightness of deadline. – While 2PL outperforms OCC when the transaction deadline is very tight, OCC performs better when the transaction deadline becomes looser. OCC outperforms 2PL regarding to total weighted value because of limited blocking value. – OCC is not sensitive to the length of transactions. It can perform well even for long transactions.
25
In Real-Time Database Systems OCC outperforms 2PL – deadlock freedom – predictable blocking time
26
Conclusion OCC – Algorithm – Three phase Backward vs. Forward validation OCC VS. 2PL – Disadvantage large number of transaction restart times – Advantage deadlock freedom predictable blocking time
27
Thank You!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.