450 likes | 527 Vues
Elastic Transactions. Pascal Felber Vincent Gramoli Rachid Guerraoui. Regular Transactions. Set implementation w/ sorted linked list (x < y < z). t. h. y. Regular Transactions. Set implementation w/ sorted linked list (x < y < z). t. h. y. insert (z) insert(x). BEGIN_TX R(h)
E N D
Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui
Regular Transactions Set implementation w/ sorted linked list (x < y < z) t h y
Regular Transactions Set implementation w/ sorted linked list (x < y < z) t h y insert(z) insert(x) BEGIN_TX R(h) R(y) R(t) W(y) END_TX BEGIN_TX R(h) R(y) W(h) END_TX
Regular Transactions Set implementation w/ sorted linked list (x < y < z) t h y insert(z) insert(x) BEGIN_TX R(h) R(y) R(t) W(y) END_TX BEGIN_TX R(h) R(y) W(h) END_TX
Regular Transactions Set implementation w/ sorted linked list (x < y < z) t h x y insert(z) insert(x) BEGIN_TX R(h) R(y) R(t) W(y) END_TX BEGIN_TX R(h) R(y) W(h) END_TX
Regular Transactions Set implementation w/ sorted linked list (x < y < z) t h x y insert(z) insert(x) BEGIN_TX R(h) R(y) R(t) W(y) END_TX BEGIN_TX R(h) R(y) W(h) END_TX
Regular Transactions Set implementation w/ sorted linked list (x < y < z) t h x y z insert(z) insert(x) BEGIN_TX R(h) R(y) R(t) W(y) END_TX BEGIN_TX R(h) R(y) W(h) END_TX
Regular Transactions Set implementation w/ sorted linked list (x < y < z) t h x y z insert(z) insert(x) BEGIN_TX R(h) R(y) R(t) W(y) END_TX BEGIN_TX R(h) R(y) W(h) END_TX
Regular Transactions Set implementation w/ sorted linked list (x < y < z) t h x y z insert(z) insert(x) BEGIN_TX R(h) R(y) R(t) W(y) END_TX BEGIN_TX R(h) R(y) W(h) END_TX Both transactions DO NOT commit…
Regular Transactions Set implementation w/ sorted linked list (x < y < z) t h x y z insert(z) insert(x) BEGIN_TX R(h) R(y) R(t) W(y) END_TX BEGIN_TX R(h) R(y) W(h) END_TX None of these accesses depend on the execution of the other …but both transactions COULD commit.
Large Data Structures Linked list Integer set 216 elements in avg.
Large Data Structures Linked list Integer set 216 elements in avg. 8-core Intel Xeon 1 operation / tx TinySTM (most efficient on μ-benchs AFAWK)
Static Cut Set implementation w/ sorted linked list
Static Cut Set implementation w/ sorted linked list insert(z) insert(x) BEGIN_TX R(h) R(y) R(t) W(y) END_TX BEGIN_TX R(h) R(y) W(h) END_TX
Static Cut Set implementation w/ sorted linked list insert(z) insert(x) BEGIN_TX R(h) R(y) R(t) W(y) END_TX BEGIN_TX R(h) R(y) W(h) END_TX Cut here
Static Cut Set implementation w/ sorted linked list insert(z) insert(x) insert(z) BEGIN_TX R(h) R(y) R(t) W(y) END_TX BEGIN_TX R(h) R(y) W(h) END_TX BEGIN_TX R(h) R(y) R(t) W(y) END_TX
Static Cut Set implementation w/ sorted linked list insert(z) insert(x) insert(z) BEGIN_TX R(h) R(y) R(t) W(y) END_TX BEGIN_TX R(h) R(y) W(h) END_TX BEGIN_TX R(h) R(y) R(t) W(y) END_TX Lost update issue [Valois 95]
Elastic Transactions • An elastic transaction adjusts its size dynamically by cutting it into subsequences of accesses at runtime. • The library programmer must use BEGIN_EL_TX to differentiate elastic and normal transactions. • The application programmer does not have to care about whether elastic transactions are used.
Elastic Transaction Improvement Without With
Elastic Transaction Improvement Without With
Elastic Transaction Improvement Without With
Elastic Transaction Improvement Without With
How do elastic transactions work? Key Idea: Cutting transactions dynamically insert(z) BEGIN_TX R(h) R(y) R(t) W(y) END_TX May I cut the tx here?
How do elastic transactions work? Key Idea: Cutting transactions dynamically insert(z) insert(x) BEGIN_TX R(h) R(y) R(t) W(y) END_TX BEGIN_TX R(h) R(y) W(h) END_TX Yes!
How do elastic transactions work? Key Idea: Cutting transactions dynamically insert(z) insert(x) insert(z) BEGIN_TX R(h) R(y) R(t) W(y) END_TX BEGIN_TX R(h) R(y) W(h) END_TX BEGIN_TX R(h) R(y) R(t) W(y) END_TX No!
How do elastic transactions work? Key Idea: Cutting transactions dynamically insert(z) insert(x) insert(z) BEGIN_TX R(h) R(y) ABORT END_TX BEGIN_TX R(h) R(y) W(h) END_TX BEGIN_TX R(h) R(y) R(t) W(y) END_TX The elastic transaction aborts if there is no way to cut
How is a cut achieved? BEGIN_EL_TX R(*) R(*) R(*) R(*) R(*) R(*) W(*) W(*) W(*) END_TX A cut of an elastic transaction e is well-formed if :
How is a cut achieved? BEGIN_EL_TX R(*) R(*) R(*) R(*) R(*) R(*) W(*) W(*) W(*) END_TX A cut of an elastic transaction e is well-formed if : • all subsequences contain at least 2 operations
How is a cut achieved? BEGIN_EL_TX R(*) R(*) R(*) R(*) R(*) R(*) W(*) W(*) W(*) END_TX A cut of an elastic transaction e is well-formed if : • all subsequences contain at least 2 operations • all writes of e belong to the same sub-sequence
How is a cut achieved? BEGIN_EL_TX R(*) R(*) R(*) R(*) R(*) R(*) W(*) W(*) W(*) END_TX A cut of an elastic transaction e is well-formed if : • all subsequences contain at least 2 operations • all writes of e belong to the same sub-sequence • all sub-sequences start with a read (unless e starts writing)
How is a cut achieved? A cut of an elastic transaction e is consistent if all common elements accessed by two consecutive sub-sequences are not written.
How is a cut achieved? A cut of an elastic transaction e is consistent if all common elements accessed by two consecutive sub-sequences are not written. • This avoids: R(x) R(y) W(x) W(y) NO R(x) R(x) W(x) NO
How is a cut achieved? A cut of an elastic transaction e is consistent if all common elements accessed by two consecutive sub-sequences are not written. • This avoids: • This allows: R(x) R(y) W(x) W(y) NO R(x) R(x) W(x) NO R(x) R(y) W(x) OK R(x) R(y) W(y) OK
Elastic Guarantees Elastic-opacity: A history is elastic-opaque if there are consistent cuts such that replacing each elastic tx e by its resulting subsequences form an opaque history.
Elastic Transaction Guarantees Elastic transactions: weaker than regular ones delete(q) delete(q) BEGIN_TX R(h) R(a) R(b) … W(z) END_TX BEGIN_EL_TX R(h) R(a) R(b) … W(z) END_TX Cut
Is there a limitation? • Elastic tx apply to most common operations • In linked lists, skip lists, hash tables, red-black trees… • Elastic tx apply to most common operations • Ex:delete(*)/search(*)/insert(*)/move(*,*)… • Elastic tx do not apply to complex operations • sumAll() • conditionalWrite() t h x y z
No! • For complex operations, use regular transactions • Both type of transactions combine safely sumAll() / conditionalWrite() t h x y z search(z) sumAll() BEGIN_EL_TX R(h) R(x) R(y) R(z) END_TX BEGIN_RL_TX R(h) R(x) R(y) R(z) R(t) END_TX
Related Work • Fine-grained locking: Efficient parsing of data structure • Early release: Some reads may be forgotten (release() method) • Commutative operations: High-level commutative ops do not conflict • Boosting / Open nesting: Take effect before commit-time • Abstract nesting: Partial roll-back mechanism
Related Work • Fine-grained locking: Efficient parsing of data structure Does not support composition • Early release: Some reads may be forgotten (release() method) Programmer must know when and what to release • Commutative operations: High-level commutative ops do not conflict Static identification of commutative operations is too restrictive • Boosting / Open nesting: Take effect before commit-time Complex roll-back mechanism must be defined • Abstract nesting: Partial roll-back mechanism Minimize abort costs, not the amount of unnecessary aborts
Conclusion • Elastic transaction New transactional model
Conclusion • Elastic transaction New transactional model • Easy-to-use Use BEGIN_EL_TX and END as delimiters in sequential code
Conclusion • Elastic transaction New transactional model • Easy-to-use Use BEGIN_EL_TX and END as delimiters in sequential code • Composable Elastic and regular transactions are composable
Conclusion • Elastic transaction New transactional model • Easy-to-use Use BEGIN_EL_TX and END as delimiters in sequential code • Composable Elastic and regular transactions are composable • Efficient Speedup frequently executed operations
Conclusion • Elastic transaction New transactional model • Easy-to-use Use BEGIN_EL_TX and END as delimiters in sequential code • Composable Elastic and regular transactions are composable • Efficient Speedup frequently executed operations • Future work Characterize the requirements to use elastic transactions
Thank you http://lpd.epfl.ch/gramoli/php/estm.php