22
This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under grant agreement n° 318693 Yaroslav Hayduk , Anita Sobe, Pascal Felber University of Neuchâtel, Switzerland Dynamic Parallel Message Processing with Transactional Memory in the Actor Model DMTM January 22, 2014

This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

Embed Size (px)

Citation preview

Page 1: This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under grant agreement n° 318693

Yaroslav Hayduk, Anita Sobe, Pascal Felber

University of Neuchâtel, Switzerland

Dynamic Parallel Message Processing with Transactional Memory in the Actor Model

DMTM January 22, 2014

Page 2: This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

DMTM 2014. Yaroslav Hayduk, Anita Sobe, Pascal Felber 2

A bit of background: The Actor Model

Hewitt & Baker (IFIP Congress’77) – „Laws for Communicating Parallel Processes“

Motivated by the prospect of highly parallel computing machines with many microprocessors + own local memory

Page 3: This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

DMTM 2014. Yaroslav Hayduk, Anita Sobe, Pascal Felber 3

OOP and actors

Everything is an actor (VS an object)

Asynchronous message passing

Has access to its local state only

Strong encapsulation

Inherently concurrent

Page 4: This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

DMTM 2014. Yaroslav Hayduk, Anita Sobe, Pascal Felber 4

OOP and actors: Communication

Object A

ObjectB.publicMethod()ObjectB.publicField=10

ActorB.publicField = 10

ActorA [SendMessageTo] ActorB

VS

asynchronous message passing

direct access

Illegal: strong encapsulation

Object B

Object A Object A

Page 5: This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

DMTM 2014. Yaroslav Hayduk, Anita Sobe, Pascal Felber 5

Problem statement

Sequential processing of messages limits performance & throughput

Concurrent message processing using STM (Hayduk et al., OPODIS 2013)

is NOT optimal in cases of high contention

Page 6: This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

DMTM 2014. Yaroslav Hayduk, Anita Sobe, Pascal Felber 6

Main contributions

We propose to

adapt the number of threads to the workload

extract read-only messages from the transactional context

Page 7: This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

DMTM 2014. Yaroslav Hayduk, Anita Sobe, Pascal Felber 7

Concurrent message processing

2 5 6 8 9

Local Actor state

In progress:Contains 8

A

BActor C (“List” Actor)

Remove 9

Contains 2

Problems in the case of high contention?

In progress:Insert 8

Thread Pool

……

Active threads

Page 8: This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

DMTM 2014. Yaroslav Hayduk, Anita Sobe, Pascal Felber 8

Idea 1: Dynamically adjust the # of threads

2 5 6 8 9

Local Actor state

In progress:Contains 8

A

BActor C (“List” Actor)

Remove 9

Contains 2

In progress:Insert 8

Thread Pool

……

Active threads Idle resources

Page 9: This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

DMTM 2014. Yaroslav Hayduk, Anita Sobe, Pascal Felber 9

Idea 1: Dynamically adjust the # of threads

Use a simple heuristic

Measure the

If decrease the thread count, otherwise – increase it

Page 10: This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

DMTM 2014. Yaroslav Hayduk, Anita Sobe, Pascal Felber 10

Can we exploit the idle resources?

Use them for specific read-only operations operations with relaxed atomicity and isolation semantics!

Idea 2: Use idle threads for relaxed operations

Page 11: This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

DMTM 2014. Yaroslav Hayduk, Anita Sobe, Pascal Felber 11

Example: List Actor operations

Actor

private listData=Ref(data)Very these

depending on

Insert/Remove/Contains

Messages

Relaxed sum…..

Messages

Page 12: This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

DMTM 2014. Yaroslav Hayduk, Anita Sobe, Pascal Felber 12

Modified Scala STM

Ref

volatile protected_data

Ref object methods:

get()….

relaxedGet()….

Transaction Scopes:atomic{}

atomic.unrecorded{}

Since it’s a write-back STM, we can safely access the value directly

Our singleRelaxedGet() operation

Page 13: This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

DMTM 2014. Yaroslav Hayduk, Anita Sobe, Pascal Felber 13

Idea 2: Use idle threads for relaxed consist. task

2 5 6 8 9

Local Actor state

In progress:Contains 8

A

B Actor C (“List” Actor)

Remove 9

Contains 2

In progress:Inconsistent Sum

Thread Pool

TM ThreadsRelaxed consist.

Threads

Page 14: This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

DMTM 2014. Yaroslav Hayduk, Anita Sobe, Pascal Felber 14

Experimental settings

• Software: Scala 2.12 & Akka 2.10 & ScalaSTM 0.7

• Hardware: 48-core AMD Opteron 6172 CPUs running at 2.1GHz

Page 15: This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

DMTM 2014. Yaroslav Hayduk, Anita Sobe, Pascal Felber 15

Evaluation: Application overview

A

A List Range (1..25) Actor

Global relaxed list sum

A List Range (100..125) Actor

……….

B

TM Insert/Remove/C

ontains

1) Stateful distributed sorted integer linked-list

Page 16: This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

DMTM 2014. Yaroslav Hayduk, Anita Sobe, Pascal Felber 16

Evaluation: Application overview

2) Multiple-point geostatistics application (Hydra)

When found, assign the value Z(y)to the simulation grid

Page 17: This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

DMTM 2014. Yaroslav Hayduk, Anita Sobe, Pascal Felber 17

2) The Multiple-point geostatistics application

Actor

private grid=Ref(data)

SimulationMessages

SnapshotMessages

Page 18: This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

DMTM 2014. Yaroslav Hayduk, Anita Sobe, Pascal Felber 18

Results – list benchmarkList write-dominated workload: static thread allocation.

List write-dominated workload: dynamic thread allocation.

More write-write conflictsresolved by killing one txn

more read-write conflicts,which are resolved by waiting

Page 19: This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

DMTM 2014. Yaroslav Hayduk, Anita Sobe, Pascal Felber 19

Results – HydraStatic thread allocation; STM message throughput and total message throughput.

Dynamic thread allocation; STM message throughput and total message throughput.

Static ratio3 Read-only threads29 TM threads

Page 20: This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

DMTM 2014. Yaroslav Hayduk, Anita Sobe, Pascal Felber 20

Results – Hydra

Simulation of the hydraulic subsurface: static and dynamic thread allocation; rollbacks.

Benefits of varying the TM thread count

Static ratio3 Read-only threads29 TM threads

Page 21: This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

DMTM 2014. Yaroslav Hayduk, Anita Sobe, Pascal Felber 21

Summary

By dynamically varying the number of threads, we increased the Actor message throughput;

used idle resources for relaxed consistency operations;

the combination of both approaches yields the best performance

Page 22: This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/2007-2013] under

DMTM 2014. Yaroslav Hayduk, Anita Sobe, Pascal Felber 22

Questions?