Elastic Transactions Pascal Felber Vincent Gramoli Rachid Guerraoui.

Post on 15-Jan-2016

220 views 0 download

Tags:

transcript

Elastic Transactions

Pascal FelberVincent Gramoli

Rachid Guerraoui

Regular Transactions

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

yy tthh

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)

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)

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

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

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

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

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…

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.

Large Data Structures

Linked list Integer set216 elements in avg.

Large Data Structures

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

Static Cut

Set implementation w/ sorted linked list

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)

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

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

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]

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 ImprovementWithout With

Elastic Transaction ImprovementWithout With

Elastic Transaction ImprovementWithout With

Elastic Transaction ImprovementWithout With

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?

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!

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!

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

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

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

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

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

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)

R(x)

R(y) W(y)

R(x)

R(y)

W(x) W(y)

OKOK

NO R(x)

R(x) W(x)

NO

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

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

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

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

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

Conclusion• Elastic transaction

New transactional model

Conclusion• Elastic transaction

New transactional model

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

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

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

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

Thank you

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