Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Design Patterns with Actors

The actor based paradigm is pretty cool. Its ability to scale effectively makes it a paradigm to must-evaluate for any concurrent system. I have done some reading about it, and have a decent idea about the core intent: drive your expensive operation with messages and multiple "actors" to minimize waits due to request/response interactions thereby increasing the throughput of your system. However, I have not had sufficient exposure to the design patterns people use with actors. I am looking for design patterns for actor based systems.

A common example of an actor design pattern is a system where there is a master-coordinator actor and a bunch of child worker actors. They master maps the expensive operation to smaller chunks, sends the smaller chunks as messages to the bunch of workers, waits for responses from them and then reduces them all to the result. In some sophisticated examples of this pattern , the worker actors notify the master that they are ready for more work, and the master routes to them more work on demand. This ensures proper balance of work and is useful when job sizes vary quite a bit.

I searched around for literature on more actor based patterns and couldn't find any examples other than the one above yet. I am yet to go through Akka Actors project samples, but any pointers would be very useful.

like image 592
vishr Avatar asked Nov 26 '12 02:11

vishr


1 Answers

I highly recommend Derek Wyatt's "Akka Concurrency" book - it is focused on the latest Akka distribution (2.1) and goes over several best practices of using Akka and lots of design patterns (emphasizing event-driven design). It does assume a fair bit of knowledge in Scala however.

The posts from the Akka Summer of Blog series is also really helpful (several of them are also written by Derek [and one by me]).

like image 165
adelbertc Avatar answered Oct 25 '22 21:10

adelbertc