smv: selective multi-versioning stm

24
DMITRI PERELMAN IDIT KEIDAR TRANSACT 2010 SMV: Selective Multi- Versioning STM 1

Upload: kamal

Post on 23-Feb-2016

23 views

Category:

Documents


0 download

DESCRIPTION

SMV: Selective Multi-Versioning STM. Dmitri Perelman Idit Keidar. Agenda. Introduction and problem statement reduce the number of aborts memory consumption invisible reads SMV algorithm keeps versions that can help save aborts automatically removes others Preliminary evaluation - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: SMV: Selective Multi-Versioning STM

TRANSACT 2010

1

DMITRI PERELMANIDIT KEIDAR

SMV: Selective Multi-Versioning STM

Page 2: SMV: Selective Multi-Versioning STM

TRANSACT 2010

2

Agenda

Introduction and problem statement reduce the number of aborts

memory consumption invisible reads

SMV algorithm keeps versions that can help save aborts automatically removes others

Preliminary evaluation good for read-dominated workloads

Page 3: SMV: Selective Multi-Versioning STM

TRANSACT 2010

3

Forceful aborts

Aborting transactions is bad work is lost resources are wasted overall throughput decreases livelock

Page 4: SMV: Selective Multi-Versioning STM

TRANSACT 2010

4

Unnecessary aborts

Sometimes aborts are necessary continuing the run would violate correctness

And sometimes they are not the suspicion is unjustified

o1

o2C

A

necessary abort

o1

o2C

A

unnecessary abort

T2

T1

T1T2

T3

Page 5: SMV: Selective Multi-Versioning STM

TRANSACT 2010

5

Multi-Versioning in STM

Keeping multiple versions can prevent aborts

o1

o2C C cannot read the

latest version – read the previous

one

o1

o2C

cannot read the latest version –

abort

A

T1 T2 T1 T2

Single-versioned STM Multi-versioned STM

Page 6: SMV: Selective Multi-Versioning STM

TRANSACT 2010

6

GC challenge

Must clean up the old versionsMany existing TMs keep a list of n past

versions some kept versions are useless some potentially useful versions are removed

o1

o2The sixth version is removed

The needed version has

been removed

A

TM keeps the list of 5 past

object versions

Past versions are kept

though they will never be

read

T1 T2

Page 7: SMV: Selective Multi-Versioning STM

TRANSACT 2010

7

Visibility challenge

Changes in memory accessed by other transactions demand the use of costly mechanisms (e.g., volatile

variables)

We want invisible readers do not change data that can be read by others avoid cache thrashing

Page 8: SMV: Selective Multi-Versioning STM

TRANSACT 2010

8

Agenda

Introduction and problem statement reduce the number of aborts

memory consumption invisible reads

SMV algorithm keeps versions that can help save aborts automatically removes others

Preliminary evaluation good for read-dominated workloads

Page 9: SMV: Selective Multi-Versioning STM

TRANSACT 2010

9

SMV design principles

A txn is aborted if: update txn: an object from the read-set is overwritten (like most

other STMs existing today) read-only txn: (almost) never – commits in a lock-free manner

Ti reads the latest object value written before Ti startsVersions are kept as long as they might be neededRead-only transactions are invisible

o1

o2C

C

T1 T2

o3Start time

snapshot

Page 10: SMV: Selective Multi-Versioning STM

TRANSACT 2010

10

SMV design principles – GC challenge

No transaction can know whether a given version can be removed explicit GC is not possible

A version is removed when it has no potential readers

Readers are invisible

o1

o2C

T1 T2 o1

o2C

T2

Kept Removed

Indistinguishable

Page 11: SMV: Selective Multi-Versioning STM

TRANSACT 2010

11

Automated GC in SMV

Solution: use auxiliary GC threads provided by managed memory systems remove unreachable object versions

Read-only transactions are invisible to other transactions, but visible to the “see-all” GC threads theoretically visible practically invisible (GC threads run infrequently)

Page 12: SMV: Selective Multi-Versioning STM

TRANSACT 2010

12

SMV time progress

Logical version clock incremented by update transactions upon commit implemented as a linked list of time points

Object handles hold versioned locks ala TL2 point to the latest object version only

time point 9 time point 10

time point 11

ver = 5

o1

data

curPoint

Page 13: SMV: Selective Multi-Versioning STM

TRANSACT 2010

13

Selective Multi-Versioning STM – overview

curPoint

time point 9

T1

ver = 5

o1

data5

o1

o2ver = 5

o2

data5

C

time point 10

ver = 10 ver = 10

data1

0

data1

0

ver ≤ start time?T1 T2

The value to be read

Page 14: SMV: Selective Multi-Versioning STM

TRANSACT 2010

14

Selective Multi-Versioning STM – GC overview

curPoint

time point 9

o1

data5

o1

o2

o2

data5

C

time point 10

ver = 10 ver = 10

data1

0

data1

0

C

time point 11

T1 T2

T1

Old versions are kept as long as they have potential readers after that they are garbage collected automatically

Page 15: SMV: Selective Multi-Versioning STM

TRANSACT 2010

15

“Unready” time points issue

Committing transaction: first inserts the new time point then updates the write-set

Potential problem:

A similar problem is the reason for using locks + double checking in TL2 (each read is pre- and post-validated)

curPoint

time point 9

T2

ver = 5

o1

data5

ver = 5

o2

data5

time point 10

ver = 10

data1

0

ver ≤ start time?

reads o1 and o2

T1writes o1 and o2

correctness violation!

paused

Page 16: SMV: Selective Multi-Versioning STM

TRANSACT 2010

16

“Unready” time points solution

Each time point has a boolean ready flag true when all the objects are updated

readyPoint points to the latest time point in the ready prefix

curPointtime point 9ready = true

T2

ver = 5

o1

data5

ver = 5

o2

data5

time point 10

ready = false

ver = 10

data1

0

ver ≤ start time?

reads o1 and o2

T1writes o1 and o2

consistent snapshot

readyPoint

paused

Page 17: SMV: Selective Multi-Versioning STM

TRANSACT 2010

17

Limiting time point traversals

The number of traversed time points might be large a long read-only txn interleaves with a lot of short update txns

Limit this number the txn is aborted after traversing WindowSize time points

Breaks the guarantee of unabortable read-only txns but improves performance

T1

… …

WindowSize

time point 9 time point 10 time point 11 time point 59 time point 60

Page 18: SMV: Selective Multi-Versioning STM

TRANSACT 2010

18

Agenda

Introduction and problem statement reduce the number of aborts

memory consumption invisible reads

SMV algorithm keeps versions that can help save aborts automatically removes others

Preliminary evaluation good for read-dominated workloads

Page 19: SMV: Selective Multi-Versioning STM

TRANSACT 2010

19

Preliminary evaluation – experiment setup

STMBench7 evaluation framework – Java version read-dominated and read-write workloads support

Implemented the following algorithms: SMV (WindowSize = 100) SMVUnlimited (WindowSize = ∞) TL2-style – mimics the basic behavior of TL2 k-versioned – each object keeps k versions (like in LSA)

Did not use the software optimizations used in the original algorithms common code platform for comparing the algorithmic issues

only

Page 20: SMV: Selective Multi-Versioning STM

TRANSACT 2010

20

Read-dominated workloads

1 2 4 8 16 320

0.2

0.4

0.6

0.8

1

SMV

SMVUnlimited

4-ver

8-ver

TL2-Style

Threads (log scale)

Com

mit

ratio

1 2 4 8 16 320

100

200

300

400

500

600

700SMV

SMVUnlimited

4-ver

8-ver

TL2-Style

Threads (log scale)

Tran

sact

ions

/sec

Emphasize the strong sides of SMV: intensive use of old object versions by read-only txns read-only txns do not need to traverse many time points

Page 21: SMV: Selective Multi-Versioning STM

TRANSACT 2010

21

Read-write workloads

1 2 4 8 16 320

100

200

300

400

500

600SMV

SMVUnlimited

4-ver

8-ver

TL2-Style

Threads (log scale)

Tran

sact

ions

/sec

1 2 4 8 16 320

0.2

0.4

0.6

0.8

1

SMV

SMVUnlimited

4-ver

8-ver

TL2-Style

Threads (log scale)

Com

mit

ratio

Present the worst-case scenario for SMV: update txns cannot leverage multiple versions (low commit-ratio) read-only txns traverse long time point list suffixes (high overhead)

Page 22: SMV: Selective Multi-Versioning STM

TRANSACT 2010

22

Memory consumption

1 16 320

200

400

600

800

1000

1200SMVSMVUnlimited4-ver8-verTL2

Threads

MB

ytes

1 16 320

200

400

600

800

1000

1200

1400SMVSMVUnlimited4-ver8-verTL2

Threads

MB

ytes

SMVUnlimited memory consumption is high

because of long read-only txns

Read-dominated workloads

Read-write workloads

SMV memory consumption is low – for most of the

objects keeps last version only

Page 23: SMV: Selective Multi-Versioning STM

TRANSACT 2010

23

Further work

Deuce framework field-based synchronization STAMP + STMBench7 benchmarks built-in

Profiling overhead vs. aborts rate

GC threads in the non-managed environment fine-tuned GC for txn objects

Page 24: SMV: Selective Multi-Versioning STM

TRANSACT 2010

24

Thank you