This project and the research leading to these results has received funding from the European Community's Seventh Framework Programme [FP7/ ] under grant agreement n° 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
DMTM Yaroslav Hayduk, Anita Sobe, Pascal Felber 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 2
DMTM Yaroslav Hayduk, Anita Sobe, Pascal Felber OOP and actors Everything is an actor (VS an object) Asynchronous message passing Has access to its local state only Strong encapsulation Inherently concurrent 3
DMTM Yaroslav Hayduk, Anita Sobe, Pascal Felber OOP and actors: Communication 4 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
DMTM Yaroslav Hayduk, Anita Sobe, Pascal Felber 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 5
DMTM Yaroslav Hayduk, Anita Sobe, Pascal Felber Main contributions We propose to adapt the number of threads to the workload extract read-only messages from the transactional context 6
DMTM Yaroslav Hayduk, Anita Sobe, Pascal Felber Concurrent message processing Local Actor state In progress: Contains 8 A A B B Actor C (“List” Actor) Remove 9 Contains 2 Problems in the case of high contention? In progress: Insert 8 Thread Pool …… Active threads
DMTM Yaroslav Hayduk, Anita Sobe, Pascal Felber Idea 1: Dynamically adjust the # of threads Local Actor state In progress: Contains 8 A A B B Actor C (“List” Actor) Remove 9 Contains 2 In progress: Insert 8 Thread Pool …… Active threadsIdle resources
DMTM Yaroslav Hayduk, Anita Sobe, Pascal Felber Idea 1: Dynamically adjust the # of threads Use a simple heuristic Measure the If decrease the thread count, otherwise – increase it 9
DMTM Yaroslav Hayduk, Anita Sobe, Pascal Felber Can we exploit the idle resources? Use them for specific read-only operations operations with relaxed atomicity and isolation semantics! 10 Idea 2: Use idle threads for relaxed operations
DMTM Yaroslav Hayduk, Anita Sobe, Pascal Felber Example: List Actor operations 11 Actor private listData=Ref(data) Very these depending on Insert/ Remove/Contai ns Messages Relaxed sum ….. Messages
DMTM Yaroslav Hayduk, Anita Sobe, Pascal Felber Modified Scala STM 12 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
DMTM Yaroslav Hayduk, Anita Sobe, Pascal Felber Idea 2: Use idle threads for relaxed consist. task Local Actor state In progress: Contains 8 A A B B Actor C (“List” Actor) Remove 9 Contains 2 In progress: Inconsistent Sum Thread Pool … TM Threads Relaxed consist. Threads
DMTM Yaroslav Hayduk, Anita Sobe, Pascal Felber Experimental settings Software: Scala 2.12 & Akka 2.10 & ScalaSTM 0.7 Hardware: 48-core AMD Opteron 6172 CPUs running at 2.1GHz 14
DMTM Yaroslav Hayduk, Anita Sobe, Pascal Felber 15 Evaluation: Application overview A A A List Range (1..25) Actor Global relaxed list sum A List Range ( ) Actor ………. B B TM Insert/Remove/C ontains 1) Stateful distributed sorted integer linked-list
DMTM 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
DMTM Yaroslav Hayduk, Anita Sobe, Pascal Felber 2) The Multiple-point geostatistics application 17 Actor private grid=Ref(data) Simulation Messages Snapshot Messages
DMTM Yaroslav Hayduk, Anita Sobe, Pascal Felber Results – list benchmark 18 List write-dominated workload: static thread allocation. List write-dominated workload: dynamic thread allocation. More write-write conflicts resolved by killing one txn more read-write conflicts, which are resolved by waiting
DMTM Yaroslav Hayduk, Anita Sobe, Pascal Felber Results – Hydra 19 Static thread allocation; STM message throughput and total message throughput. Dynamic thread allocation; STM message throughput and total message throughput. Static ratio 3 Read-only threads 29 TM threads
DMTM Yaroslav Hayduk, Anita Sobe, Pascal Felber Results – Hydra 20 Simulation of the hydraulic subsurface: static and dynamic thread allocation; rollbacks. Benefits of varying the TM thread count Static ratio 3 Read-only threads 29 TM threads
DMTM Yaroslav Hayduk, Anita Sobe, Pascal Felber 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 21
DMTM Yaroslav Hayduk, Anita Sobe, Pascal Felber Questions? 22