SlideShare a Scribd company logo
1 of 14
Akka 101
Actor based concurrency framework
What is akka?
Event Driven
Asynchronous
Distributed
Reactive
Responsive: Respond in timely manner if possible
Resilient: Responsive in case of failure
Why Akka?
Actors
Light weight object (around 300 bytes of memory)
Accept messages and do whatever they are supposed to do with them
Process one message at a time
Each actor has messaging queue
Asynchronous
Serializable and passed to other clients/actors
Why actors, why not threads
Concurrency : When two threads are making progress. Parallelism that can
include time slicing.
Parallelism: When two threads are executing simultaneously.
Shared states are real evil. Can cause race condition, dead locks, blocking
calls.
Actors keep mutable state internal.
Actors communicate through messages. No shared state between outside
Message Passing
Fire and forget
Send and wait
Send and reply using future
Akka Components
ActorSystem: Actor, ActorRef, MessageDispatcher, Mailbox, Message Queue.
ActorRef: Addressable destination of actor
MessageDispatcher:
Engine that runs parts of actor system and schedule all activity. Main responsibility to run
mailbox.
ActorRef -> MessageDispatcher -> MessageQueue of destination mailbox
Mailbox: Hold actors. Takes message from message queue and invokes a
actor.
Actor Hierarchies and path
All actors belong to actor hierarchies in actor system.
Two separate hierarchies:
System Hierarchies : Manage internal tasks
User hierarchies : Defines actor for our application
User level root actor (named Guardian) under which all actors are created.
Actor Path: akka://MySystem@MyServer:MyPort/user/TopActor/ChildActor
akka is the name of the scheme
Supervise
Actor can supervise other actors
Supervisor detects and respond to failures
On actor crash, a notification is send to its supervisor to decide what to do
Helps provide clean separation between error handling and message
processing
Fault handling strategy:
Supervision and Monitoring
Every actor has a supervisor who created the current one.
Responsible for watching its subordinates and handling their problem.
Actor detects failure and suspend itself. Supervisor helps by :
Resume its subordinate
Restart the subordinate
Terminate permanently
Escalate the failure to its supervisor
Routers
Type of actor
Layer between ActorRef and Actor
Route Message to underlying actor
Non cluster example:
Round robin
Consistent hashing
Random etc
Use case
Processing pipeline
Streaming data
Multi-user concurrency (as one actor run at one time)
Systems high uptime requirement (Supervisor make sure actor is live)
Application with shared state
Thanks!
References
https://media.itm.uni-luebeck.de/teaching/ws2012/sem-sse/martin-thurau-
akka.io.pdf
http://akka.io/docs/

More Related Content

What's hot

CSP: Huh? And Components
CSP: Huh? And ComponentsCSP: Huh? And Components
CSP: Huh? And Components
Daniel Fagnan
 

What's hot (20)

Actors and Threads
Actors and ThreadsActors and Threads
Actors and Threads
 
The Actor Model - Towards Better Concurrency
The Actor Model - Towards Better ConcurrencyThe Actor Model - Towards Better Concurrency
The Actor Model - Towards Better Concurrency
 
Introduction to Akka
Introduction to AkkaIntroduction to Akka
Introduction to Akka
 
Introduction to actor model with examples on Akka.NET
Introduction to actor model with examples on Akka.NETIntroduction to actor model with examples on Akka.NET
Introduction to actor model with examples on Akka.NET
 
Introduction to the Actor Model
Introduction to the Actor ModelIntroduction to the Actor Model
Introduction to the Actor Model
 
Reactive applications with Akka.Net - DDD East Anglia 2015
Reactive applications with Akka.Net - DDD East Anglia 2015Reactive applications with Akka.Net - DDD East Anglia 2015
Reactive applications with Akka.Net - DDD East Anglia 2015
 
The dark side of Akka and the remedy
The dark side of Akka and the remedyThe dark side of Akka and the remedy
The dark side of Akka and the remedy
 
Actor Patterns and NATS - Boulder Meetup
Actor Patterns and NATS - Boulder MeetupActor Patterns and NATS - Boulder Meetup
Actor Patterns and NATS - Boulder Meetup
 
Driver
DriverDriver
Driver
 
Full-Stack, Message-oriented Programming w/ Akka.NET Actors
Full-Stack, Message-oriented Programming w/ Akka.NET ActorsFull-Stack, Message-oriented Programming w/ Akka.NET Actors
Full-Stack, Message-oriented Programming w/ Akka.NET Actors
 
Akka Actors
Akka ActorsAkka Actors
Akka Actors
 
Concurrency in Smalltalk -- Beyond Threads
Concurrency in Smalltalk -- Beyond ThreadsConcurrency in Smalltalk -- Beyond Threads
Concurrency in Smalltalk -- Beyond Threads
 
Introduction to Functional Reactive Programming
Introduction to Functional Reactive ProgrammingIntroduction to Functional Reactive Programming
Introduction to Functional Reactive Programming
 
Scala Italy 2015 - An Introduction to Akka and the Actor Based Model
Scala Italy 2015 - An Introduction to Akka and the Actor Based ModelScala Italy 2015 - An Introduction to Akka and the Actor Based Model
Scala Italy 2015 - An Introduction to Akka and the Actor Based Model
 
Actor Model & Reactive Manifesto
Actor Model & Reactive ManifestoActor Model & Reactive Manifesto
Actor Model & Reactive Manifesto
 
C#: Understanding ConfigureAwait(false)
C#: Understanding ConfigureAwait(false)C#: Understanding ConfigureAwait(false)
C#: Understanding ConfigureAwait(false)
 
Intro to elixir and phoenix
Intro to elixir and phoenixIntro to elixir and phoenix
Intro to elixir and phoenix
 
CSP: Huh? And Components
CSP: Huh? And ComponentsCSP: Huh? And Components
CSP: Huh? And Components
 
Project Orleans - Actor Model framework
Project Orleans - Actor Model frameworkProject Orleans - Actor Model framework
Project Orleans - Actor Model framework
 
Akka - young fighter course
Akka - young fighter courseAkka - young fighter course
Akka - young fighter course
 

Viewers also liked

Ph D Proposal, Cloud Computing Security
Ph D Proposal, Cloud Computing SecurityPh D Proposal, Cloud Computing Security
Ph D Proposal, Cloud Computing Security
Zhi Guan
 
3d Max Render 01 Raytrace Skylight
3d Max Render 01 Raytrace Skylight3d Max Render 01 Raytrace Skylight
3d Max Render 01 Raytrace Skylight
lab_digital
 
Curriculum vitae
Curriculum vitaeCurriculum vitae
Curriculum vitae
Sara_20
 
Qué obtiene una institución que se afilia a red pa paz doc.docx
Qué obtiene una institución que se afilia a red pa paz doc.docxQué obtiene una institución que se afilia a red pa paz doc.docx
Qué obtiene una institución que se afilia a red pa paz doc.docx
Red PaPaz
 
Analisis de problemas de manejos de los materiales
Analisis de problemas de manejos de los materialesAnalisis de problemas de manejos de los materiales
Analisis de problemas de manejos de los materiales
raimer_1987
 
Cv Interim English
Cv Interim EnglishCv Interim English
Cv Interim English
mroseeu
 
Odontología Neurofocal
Odontología NeurofocalOdontología Neurofocal
Odontología Neurofocal
Damarisdlgd8
 
Presentasi BRI Prioritas (3 agustus 2013)
Presentasi BRI Prioritas (3 agustus 2013)Presentasi BRI Prioritas (3 agustus 2013)
Presentasi BRI Prioritas (3 agustus 2013)
lia_aluyah
 

Viewers also liked (20)

Akka -- Scalability in Scala and Java
Akka -- Scalability in Scala and JavaAkka -- Scalability in Scala and Java
Akka -- Scalability in Scala and Java
 
Ph D Proposal, Cloud Computing Security
Ph D Proposal, Cloud Computing SecurityPh D Proposal, Cloud Computing Security
Ph D Proposal, Cloud Computing Security
 
3d Max Render 01 Raytrace Skylight
3d Max Render 01 Raytrace Skylight3d Max Render 01 Raytrace Skylight
3d Max Render 01 Raytrace Skylight
 
Curriculum vitae
Curriculum vitaeCurriculum vitae
Curriculum vitae
 
Qué obtiene una institución que se afilia a red pa paz doc.docx
Qué obtiene una institución que se afilia a red pa paz doc.docxQué obtiene una institución que se afilia a red pa paz doc.docx
Qué obtiene una institución que se afilia a red pa paz doc.docx
 
Analisis de problemas de manejos de los materiales
Analisis de problemas de manejos de los materialesAnalisis de problemas de manejos de los materiales
Analisis de problemas de manejos de los materiales
 
Arete Industries Research Report
Arete Industries Research ReportArete Industries Research Report
Arete Industries Research Report
 
fresh Credentials
fresh Credentialsfresh Credentials
fresh Credentials
 
Clase 10 CSyP
Clase 10 CSyPClase 10 CSyP
Clase 10 CSyP
 
Cv Interim English
Cv Interim EnglishCv Interim English
Cv Interim English
 
Odontología Neurofocal
Odontología NeurofocalOdontología Neurofocal
Odontología Neurofocal
 
Berita Paroki 06-07 Februari 2016
Berita Paroki 06-07 Februari 2016Berita Paroki 06-07 Februari 2016
Berita Paroki 06-07 Februari 2016
 
Presentasi BRI Prioritas (3 agustus 2013)
Presentasi BRI Prioritas (3 agustus 2013)Presentasi BRI Prioritas (3 agustus 2013)
Presentasi BRI Prioritas (3 agustus 2013)
 
150309 presentación innovación sostenible eoi healc
150309 presentación innovación sostenible eoi healc150309 presentación innovación sostenible eoi healc
150309 presentación innovación sostenible eoi healc
 
Galleta de soda
Galleta de sodaGalleta de soda
Galleta de soda
 
Finanças dos clubes brasileiros em 2015- Amir Somoggi
Finanças dos clubes brasileiros em 2015- Amir SomoggiFinanças dos clubes brasileiros em 2015- Amir Somoggi
Finanças dos clubes brasileiros em 2015- Amir Somoggi
 
Seminario mandos intermedios
Seminario mandos intermediosSeminario mandos intermedios
Seminario mandos intermedios
 
Proteccion del medioambiente Ramos Luis
Proteccion del medioambiente   Ramos LuisProteccion del medioambiente   Ramos Luis
Proteccion del medioambiente Ramos Luis
 
Presentación del Especialista Consultor del Hospital Niño Jesús
Presentación del Especialista Consultor del Hospital Niño JesúsPresentación del Especialista Consultor del Hospital Niño Jesús
Presentación del Especialista Consultor del Hospital Niño Jesús
 
Haba
HabaHaba
Haba
 

Similar to Akka framework

Akka london scala_user_group
Akka london scala_user_groupAkka london scala_user_group
Akka london scala_user_group
Skills Matter
 

Similar to Akka framework (20)

Akka Actors: an Introduction
Akka Actors: an IntroductionAkka Actors: an Introduction
Akka Actors: an Introduction
 
Nairobi JVM meetup : Introduction to akka
Nairobi JVM meetup : Introduction to akkaNairobi JVM meetup : Introduction to akka
Nairobi JVM meetup : Introduction to akka
 
Discovering the Service Fabric's actor model
Discovering the Service Fabric's actor modelDiscovering the Service Fabric's actor model
Discovering the Service Fabric's actor model
 
Reactive programming with akka
Reactive programming with akkaReactive programming with akka
Reactive programming with akka
 
Oop2011 actor presentation_stal
Oop2011 actor presentation_stalOop2011 actor presentation_stal
Oop2011 actor presentation_stal
 
Introducing Akka
Introducing AkkaIntroducing Akka
Introducing Akka
 
GPars (Groovy Parallel Systems)
GPars (Groovy Parallel Systems)GPars (Groovy Parallel Systems)
GPars (Groovy Parallel Systems)
 
Building reactive systems with Akka
Building reactive systems with AkkaBuilding reactive systems with Akka
Building reactive systems with Akka
 
Akka 2.0 Reloaded
Akka 2.0 ReloadedAkka 2.0 Reloaded
Akka 2.0 Reloaded
 
Akka knolx
Akka knolxAkka knolx
Akka knolx
 
Reactive programming with akka
Reactive programming with akka Reactive programming with akka
Reactive programming with akka
 
Reactive Programming in Akka
Reactive Programming in AkkaReactive Programming in Akka
Reactive Programming in Akka
 
Architectural patterns part 4
Architectural patterns part 4Architectural patterns part 4
Architectural patterns part 4
 
Reactive Programming in .Net - actorbased computing with Akka.Net
Reactive Programming in .Net - actorbased computing with Akka.NetReactive Programming in .Net - actorbased computing with Akka.Net
Reactive Programming in .Net - actorbased computing with Akka.Net
 
Building Massively Scalable application with Akka 2.0
Building Massively Scalable application with Akka 2.0Building Massively Scalable application with Akka 2.0
Building Massively Scalable application with Akka 2.0
 
Actors model in gpars
Actors model in gparsActors model in gpars
Actors model in gpars
 
Akka and futures
Akka and futuresAkka and futures
Akka and futures
 
Akka london scala_user_group
Akka london scala_user_groupAkka london scala_user_group
Akka london scala_user_group
 
Discovering the Service Fabric's actor model
Discovering the Service Fabric's actor modelDiscovering the Service Fabric's actor model
Discovering the Service Fabric's actor model
 
Scale up your thinking
Scale up your thinkingScale up your thinking
Scale up your thinking
 

More from mitesh_sharma

More from mitesh_sharma (9)

Aws cost optimized logging using api gateway, sqs and elastic search
Aws  cost optimized logging using api gateway, sqs and elastic searchAws  cost optimized logging using api gateway, sqs and elastic search
Aws cost optimized logging using api gateway, sqs and elastic search
 
Stress driven development
Stress driven developmentStress driven development
Stress driven development
 
Developing Url Shortener With Dynamic Behaviour Using AWS Lambda
Developing Url Shortener With Dynamic Behaviour Using AWS LambdaDeveloping Url Shortener With Dynamic Behaviour Using AWS Lambda
Developing Url Shortener With Dynamic Behaviour Using AWS Lambda
 
Play framework : A Walkthrough
Play framework : A WalkthroughPlay framework : A Walkthrough
Play framework : A Walkthrough
 
Build and deployment with Jenkins and Code Deploy on AWS
Build and deployment with Jenkins and Code Deploy on AWSBuild and deployment with Jenkins and Code Deploy on AWS
Build and deployment with Jenkins and Code Deploy on AWS
 
Localize content Devops
Localize content DevopsLocalize content Devops
Localize content Devops
 
Play Framework Logging
Play Framework LoggingPlay Framework Logging
Play Framework Logging
 
All about InfluxDB.
All about InfluxDB.All about InfluxDB.
All about InfluxDB.
 
Memory management
Memory managementMemory management
Memory management
 

Recently uploaded

Recently uploaded (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

Akka framework

  • 1. Akka 101 Actor based concurrency framework
  • 2. What is akka? Event Driven Asynchronous Distributed Reactive Responsive: Respond in timely manner if possible Resilient: Responsive in case of failure
  • 4. Actors Light weight object (around 300 bytes of memory) Accept messages and do whatever they are supposed to do with them Process one message at a time Each actor has messaging queue Asynchronous Serializable and passed to other clients/actors
  • 5. Why actors, why not threads Concurrency : When two threads are making progress. Parallelism that can include time slicing. Parallelism: When two threads are executing simultaneously. Shared states are real evil. Can cause race condition, dead locks, blocking calls. Actors keep mutable state internal. Actors communicate through messages. No shared state between outside
  • 6. Message Passing Fire and forget Send and wait Send and reply using future
  • 7. Akka Components ActorSystem: Actor, ActorRef, MessageDispatcher, Mailbox, Message Queue. ActorRef: Addressable destination of actor MessageDispatcher: Engine that runs parts of actor system and schedule all activity. Main responsibility to run mailbox. ActorRef -> MessageDispatcher -> MessageQueue of destination mailbox Mailbox: Hold actors. Takes message from message queue and invokes a actor.
  • 8. Actor Hierarchies and path All actors belong to actor hierarchies in actor system. Two separate hierarchies: System Hierarchies : Manage internal tasks User hierarchies : Defines actor for our application User level root actor (named Guardian) under which all actors are created. Actor Path: akka://MySystem@MyServer:MyPort/user/TopActor/ChildActor akka is the name of the scheme
  • 9. Supervise Actor can supervise other actors Supervisor detects and respond to failures On actor crash, a notification is send to its supervisor to decide what to do Helps provide clean separation between error handling and message processing Fault handling strategy:
  • 10. Supervision and Monitoring Every actor has a supervisor who created the current one. Responsible for watching its subordinates and handling their problem. Actor detects failure and suspend itself. Supervisor helps by : Resume its subordinate Restart the subordinate Terminate permanently Escalate the failure to its supervisor
  • 11. Routers Type of actor Layer between ActorRef and Actor Route Message to underlying actor Non cluster example: Round robin Consistent hashing Random etc
  • 12. Use case Processing pipeline Streaming data Multi-user concurrency (as one actor run at one time) Systems high uptime requirement (Supervisor make sure actor is live) Application with shared state