45
Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

  • View
    222

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Elastic Transactions

Pascal FelberVincent Gramoli

Rachid Guerraoui

Page 2: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Regular Transactions

Set implementation w/ sorted linked list (x < y < z)

yy tthh

Page 3: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Regular Transactions

Set implementation w/ sorted linked list (x < y < z)

yy tth

BEGIN_TX R(h) R(y) R(t) W(y)END_TX

BEGIN_TX R(h) R(y) W(h)

END_TX

insert(z) insert(x)

Page 4: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Regular Transactions

Set implementation w/ sorted linked list (x < y < z)

y tthh

BEGIN_TX R(h) R(y) R(t) W(y)END_TX

BEGIN_TX R(h) R(y) W(h)

END_TX

insert(z) insert(x)

Page 5: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Regular Transactions

Set implementation w/ sorted linked list (x < y < z)

yy tth

BEGIN_TX R(h) R(y) R(t) W(y)END_TX

BEGIN_TX R(h) R(y) W(h)

END_TX

insert(z) insert(x)

xx

Page 6: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Regular Transactions

Set implementation w/ sorted linked list (x < y < z)

yy thh

BEGIN_TX R(h) R(y) R(t) W(y)END_TX

BEGIN_TX R(h) R(y) W(h)

END_TX

insert(z) insert(x)

xx

Page 7: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Regular Transactions

Set implementation w/ sorted linked list (x < y < z)

yy tthh

BEGIN_TX R(h) R(y) R(t) W(y) END_TX

BEGIN_TX R(h) R(y) W(h)

END_TX

insert(z) insert(x)

xx zz

Page 8: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Regular Transactions

Set implementation w/ sorted linked list (x < y < z)

yy tthh

BEGIN_TX R(h) R(y) R(t) W(y) END_TX

BEGIN_TX R(h) R(y) W(h)

END_TX

insert(z) insert(x)

xx zz

Page 9: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Regular Transactions

Set implementation w/ sorted linked list (x < y < z)

yy tthh

BEGIN_TX R(h) R(y) R(t) W(y) END_TX

BEGIN_TX R(h) R(y) W(h)

END_TX

insert(z) insert(x)

xx zz

Both transactions DO NOT commit…

Page 10: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Regular Transactions

Set implementation w/ sorted linked list (x < y < z)

yy tthh

BEGIN_TX R(h) R(y) R(t) W(y) END_TX

BEGIN_TX R(h) R(y) W(h)

END_TX

insert(z) insert(x)

xx zz

None of these accessesdepend on the execution of the other

None of these accessesdepend on the execution of the other

…but both transactions COULD commit.

Page 11: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Large Data Structures

Linked list Integer set216 elements in avg.

Page 12: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Large Data Structures

Linked list Integer set216 elements in avg.8-core Intel Xeon1 operation / txTinySTM (most efficient onμ-benchs AFAWK)

Page 13: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Static Cut

Set implementation w/ sorted linked list

Page 14: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Static Cut

Set implementation w/ sorted linked list

BEGIN_TX R(h) R(y)

R(t) W(y) END_TX

BEGIN_TX R(h) R(y) W(h)

END_TX

insert(z) insert(x)

Page 15: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Static Cut

Set implementation w/ sorted linked list

BEGIN_TX R(h) R(y)

R(t) W(y) END_TX

BEGIN_TX R(h) R(y) W(h)

END_TX

insert(z) insert(x)

Cut here Cut here

Page 16: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Static Cut

Set implementation w/ sorted linked list

BEGIN_TX R(h) R(y) R(t) W(y) END_TX

BEGIN_TX R(h) R(y) W(h)

END_TX

insert(z) insert(x) insert(z)

BEGIN_TX R(h) R(y) R(t) W(y)

END_TX

Page 17: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Static Cut

Set implementation w/ sorted linked list

BEGIN_TX R(h) R(y) R(t) W(y) END_TX

BEGIN_TX R(h) R(y) W(h)

END_TX

insert(z) insert(x) insert(z)

BEGIN_TX R(h) R(y) R(t) W(y)

END_TX

Lost update issue [Valois 95]

Page 18: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

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.

Page 19: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Elastic Transaction ImprovementWithout With

Page 20: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Elastic Transaction ImprovementWithout With

Page 21: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Elastic Transaction ImprovementWithout With

Page 22: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Elastic Transaction ImprovementWithout With

Page 23: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Key Idea: Cutting transactions dynamically

How do elastic transactions work?

BEGIN_TX R(h) R(y) R(t) W(y) END_TX

insert(z)

May I cut the tx here?

May I cut the tx here?

Page 24: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Key Idea: Cutting transactions dynamically

How do elastic transactions work?

BEGIN_TX R(h) R(y) R(t) W(y) END_TX

BEGIN_TX R(h) R(y) W(h)

END_TX

insert(z) insert(x)

Yes!Yes!

Page 25: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Key Idea: Cutting transactions dynamically

How do elastic transactions work?

BEGIN_TX R(h) R(y) R(t) W(y) END_TX

BEGIN_TX R(h) R(y) W(h)

END_TX

insert(z) insert(x) insert(z)

BEGIN_TX R(h) R(y) R(t) W(y)

END_TX

No!No!

Page 26: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Key Idea: Cutting transactions dynamically

How do elastic transactions work?

BEGIN_TX R(h) R(y)

ABORTEND_TX

BEGIN_TX R(h) R(y) W(h)

END_TX

insert(z) insert(x) insert(z)

BEGIN_TX R(h) R(y) R(t) W(y)

END_TX

The elastic transaction aborts if there is no way to cut

Page 27: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

How is a cut achieved?

A cut of an elastic transaction e is well-formed if :

BEGIN_EL_TX R(*) R(*) R(*) R(*) R(*) R(*) W(*) W(*) W(*)END_TX

Page 28: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

How is a cut achieved?

A cut of an elastic transaction e is well-formed if :

• all subsequences contain at least 2 operations

BEGIN_EL_TX R(*) R(*) R(*) R(*) R(*) R(*) W(*) W(*) W(*)END_TX

Page 29: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

How is a cut achieved?

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

BEGIN_EL_TX R(*) R(*) R(*) R(*) R(*) R(*) W(*) W(*) W(*)END_TX

Page 30: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

How is a cut achieved?

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)

BEGIN_EL_TX R(*) R(*) R(*) R(*) R(*) R(*) W(*) W(*) W(*)END_TX

Page 31: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

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.

Page 32: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

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

Page 33: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

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)

R(x)

R(y) W(y)

R(x)

R(y)

W(x) W(y)

OKOK

NO R(x)

R(x) W(x)

NO

Page 34: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

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 Guarantees

Page 35: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Elastic Transaction Guarantees

Elastic transactions: weaker than regular ones

BEGIN_TX R(h) R(a) R(b) … W(z)END_TX

delete(q)

BEGIN_EL_TX R(h) R(a) R(b) … W(z)END_TX

delete(q)

Cut

Page 36: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

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()

zzyy ttxxhh

Page 37: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

No!

• For complex operations, use regular transactions

• Both type of transactions combine safely

sumAll() / conditionalWrite()

zzyy ttxxhh

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

search(z) sumAll()

Page 38: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

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

Page 39: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

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 conflictStatic identification of commutative operations is too restrictive

• Boosting / Open nesting: Take effect before commit-timeComplex roll-back mechanism must be defined

• Abstract nesting: Partial roll-back mechanismMinimize abort costs, not the amount of unnecessary aborts

Page 40: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Conclusion• Elastic transaction

New transactional model

Page 41: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Conclusion• Elastic transaction

New transactional model

• Easy-to-useUse BEGIN_EL_TX and END as delimiters in sequential code

Page 42: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Conclusion• Elastic transaction

New transactional model

• Easy-to-useUse BEGIN_EL_TX and END as delimiters in sequential code

• ComposableElastic and regular transactions are composable

Page 43: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Conclusion• Elastic transaction

New transactional model

• Easy-to-useUse BEGIN_EL_TX and END as delimiters in sequential code

• ComposableElastic and regular transactions are composable

• EfficientSpeedup frequently executed operations

Page 44: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Conclusion• Elastic transaction

New transactional model

• Easy-to-useUse BEGIN_EL_TX and END as delimiters in sequential code

• ComposableElastic and regular transactions are composable

• EfficientSpeedup frequently executed operations

• Future workCharacterize the requirements to use elastic transactions

Page 45: Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui

Thank you

http://lpd.epfl.ch/gramoli/php/estm.php