Introduction to actor model of concurrent and distributed

Preview:

Citation preview

Introduction to Actor Model of Concurrent and Distributed Computation

Dmitry Tolpeko, EPAM Systems - January 2015

What is Actor Model?

Design pattern to develop scalable concurrent and distributed applications

Concurrent Models

• Shared Resources

• Actor-based Concurrency

Shared Resources

• Shared Memory

• Locks

Shared Resources - Advantages

• Traditional and well known

• OS and programming language support

• Relatively easy to program (no queues, no messaging i.e.)

Shared Resources - Disadvantages

• Error prone and buggy

• Race conditions and deadlocks

• Over-synchronization that can impact performance

• No distributed processing

Actor Model

• Similar to Object-oriented model but asynchronous, concurrent and distributed

• Actors are processes (threads) that process and send messages

• Shared nothing architecture

Asynchronous

• When an Actor sends a message it is not blocked until the message processed

• Actor is not interrupted when it receives a message

• Every Actor has Mailbox, a task queue to buffer incoming messages

Concurrent and Distributed

• Each Actor runs an infinite loop to read, process and send messages

• Use of messaging allows distributed processing (Multiple Actors running on multiple nodes)

Topology and Life Cycle

• Actors can create other actors, the topology is dynamic

• Actor usually terminates by receiving the application specific “Stop” message

• Actor can also terminate by timeout (no messages in queue) or after completing a message

Advantages of Actor Model

• Scalable

• Clear and reliable design

Thank you!Dmitry_Tolpeko@epam.com

https://twitter.com/dmtolpeko

www.dmtolpeko.com

Join Belarus Hadoop User Group at LinkedIn

Recommended