SlideShare a Scribd company logo
1 of 62
Akka in Action
Raymond Roestenburg
@RayRoestenburg
rroestenburg@xebia.com
github.com/RayRoestenburg
manning.com/roestenburg
12mp25 for 42% Off!
Early Akka adopter (v0.7, 2010)
Akka Committer (akka-camel in 2.x)
Co-author of Akka in Action
“The free lunch is over” / TANSTAAFL
Herb Sutter 2005 http://www.gotw.ca/publications/concurrency-ddj.htm
Number
of transistors
Clock Speed
Can‟t I just..
Parallelize
that Sh*t™?
Put that in a box!
Something like this?
Parallel
Version
9
Hey Oracle don‟t sue me, of course it‟s fake
Nope. Parallelize that Sh*t™
Not every algorithm can be parallelized
Dynamic coordination (concurrent)
Amdahl‟s Law
Sequential fraction determines max speedup
Threads?
Shared (mutable) state + locks
Require synchronization
Diminishing returns**
Which primitives to use?
Difficult to predict & maintain
Deadlock
Livelock
Thread starvation
Race condition
*Using threads directly is meant here
**Performance improvement degrades with more threads than cores.
“Life is too short for
Blocking code”*
*Mario Fusco just the other day on twitter
Why Async? Less latency.
Service
Service A
Service B
Service C
4 sec
6 sec
3 sec
Sync takes 13 seconds
Async takes max 6 seconds
Asynchronous „first completed response‟ is easy to do
1. The world is concurrent
2. Things in the world don't share data
3. Things communicate with messages
4. Things fail
Joe Armstrong (creator of Erlang)
We need better tools to build..
Reactive*
Applications
* The latest need-to-know buzz word!
event driven
scalable
asynchronous
resilient
Scale Up and Out
Concurrent
Distributed
Many Nodes
Many ThreadsAkkaA uniform model for both up
and out, embraces
concurrency and failure
Maximize the use of cores
_and_ nodes.
Concurrent(moreCores)
Distributed (more Nodes)
Actors
Futures
Agents
Scale Up
Processes (even less**)
Actors (2.7 million / 1GB)
Threads (4096 / 1GB)
Actors are small*
* Disclaimer: text is not shown to scale, actors are way smaller..
** Especially JVM processes
Reactive Asynchronous Building Blocks
1. CREATE
2. SEND
3. BECOME
4. SUPERVISE*
Actor
Actor
Instance
ActorRef
Mailbox
ActorRef
Actor
Instance
ActorRef
Mailbox
Points to Actor
Delivers messages to Mailbox
Mailbox
Actor
Instance
ActorRef
Mailbox
Processes Messages asynchronously*
Invokes Actor Instance with message
*The Mailbox runs on a Dispatcher that abstracts threading
Actor Instance
Actor
Instance
ActorRef
Mailbox
Receives messages one at a time
Your code runs here.
Actor Instance
Crashed Actor
Instance
Mailbox
An Actor Instance crashes instead of handling
Exceptions. A Supervisor decides it‟s fate.
ActorRef
Restart / Resume / Stop / Escalate
New Actor
Instance
ActorRef
Actor
Instance
Mailbox
Immutable. Only the ActorRef is accessible
From the outside.
ActorRef
ActorRef
Actor
Instance
Mailbox
The ActorRef is used
for both local and remote actors.
ActorRef
ActorRef
Actor
Instance
Mailbox
The ActorRef always points 1 on 1 to the
„same‟ Actor instance. (Alive or Restarted)
ActorRef
Actor
Instance
ActorRef
Dead Actor
Instance
Mailbox
The ActorRef points to deadletters ActorRef
when the actor is dead (terminated).
ActorRef
deadletters
msg
msg
Immutable messages
msg
Location
Transparency
msg Serialized messages
Actor System
Actor System
Actor System
Actor systems
Event
Immutable messages
msg
msg
app@node2
app@node1
app@node3
“app” clustered
actor system
On three nodes
Clustered actor system
msg
msg
“GoTicks.com”
Build a REST API
PUT /events
{
“event” : “RHCP”,
“nrOfTickets”: 300
}
GET /ticket/RHCP
Response:
{
“event”: “RHCP”,
“nr”: 1
}
GET /events
Response:
[
{ “event”: “RHCP”, “nrOfTickets”: 299 }
]
RestApi
Ticket
Seller
Ticket
Seller
BoxOffice
GoTicks.com
Spray
&
Akka
“goticks” ActorSystem
REST Spray-can
GoTicks.com
REST Interface
Handles HTTP calls
Translates to and from
JSON
RestApi
REST Spray-can
GoTicks.com
BoxOffice
REST Spray-can
BoxOffice
Creates Events
Creates TicketSeller
One for every Event
Partition / shard per event
Many sharding strategies possible
GoTicks.com
Ticket
Seller
Ticket
Seller
REST Spray-can
TicketSeller
Contains list of Tickets
Sells Tickets for a Event
until SoldOut
RestApi
Ticket
Seller
Ticket
Seller
BoxOffice
Clustered GoTicks.com
Ticket
Seller
Ticket
Seller
BoxOffice
Consistent
Hashing
Consistent
Hashing
Code
1. CREATE
Inside our Main class…
val system = new ActorSystem(“goticks”)
Create
The system
ActorSystem(“goticks”)
Inside Main…
val system = new ActorSystem(“goticks”)
val api = system.actorOf(
Props[RestInterface],
“httpInterface”)
…
CREATE
RestInterface
ActorSystem(“goticks”)
Top Level Actor
ActorSystem(“goticks”)
REST Interface
Inside Main…
val system = new ActorSystem(“goticks”)
val api = system.actorOf(
Props[RestInterface],
“httpInterface”)
…
CREATE
RestInterface
ActorSystem(“goticks”)
Factory/Creator/ Immutable Configuration object
ActorSystem(“goticks”)
REST Interface
Inside Main…
val system = new ActorSystem(“goticks”)
val api = system.actorOf(
Props[RestInterface],
“httpInterface”)
…
CREATE
RestInterface
ActorSystem(“goticks”)
ActorRef to the Actor
ActorSystem(“goticks”)
REST Interface
ActorSystem(“goticks”)ActorSystem(“goticks”)
Inside RestInterface..
val master = context.actorOf(
Props[BoxOffice],”boxOffice”
)
1. CREATE
BoxOffice
REST Interface
BoxOffice
Child of
REST Interface Actor
ActorSystem(“goticks”)ActorSystem(“goticks”)
Inside RestInterface..
val master = context.actorOf(
Props[BoxOffice],”boxOffice”
)
1. CREATE
BoxOffice
REST Interface
BoxOffice
An Actor has a name, part of an ActorPath
Inside BoxOffice…
val child = context.actorOf(
Props[TicketSeller],
eventName
)
1. CREATE
TicketSeller
ActorSystem(“goticks”)ActorSystem(“goticks”)
REST Interface
BoxOffice
TicketSeller
Child of
BoxOffice Actor
Inside BoxOffice…
val child = context.actorOf(
Props[TicketSeller],
eventName
)
1. CREATE
TicketSeller
ActorSystem(“goticks”)ActorSystem(“goticks”)
REST Interface
BoxOffice
TicketSeller
Ticket sellers are named by event
2. SEND/RECEIVE
Receiving messages
class BoxOffice extends Actor {
def receive = {
case TicketRequest(name) =>
…
case GetEvents =>
…
case event: Event =>
…
}
}
Pattern Matching
On Messages
Receiving messages
class TicketSeller extends Actor {
def receive = soldOut
def soldOut:Receive = {
case Tickets(newTickets) =>
.. //store new tickets
become(selling)
}
def selling:Receive = {
case BuyTicket(name) =>
…
}
}
Partial Function
3. BECOME:
You can change th
behavior at
every msg
Create Event
ActorSystem(“goticks”)ActorSystem(“goticks”)
REST Interface
BoxOffice
Event(“RHCP”, 250)
{ event: “RHCP” nrOfTickets: 250}
Inside RestInterface… (receives JSON, unmarshall to event)
boxOffice ! event
Create Event
ActorSystem(“goticks”)ActorSystem(“goticks”)
REST Interface
BoxOffice
Event(“RHCP”, 250)
{ event: “RHCP” nrOfTickets: 250}
Inside RestInterface… (receives JSON, unmarshall to event)
boxOffice ! event
Bang Operator
„Tell‟
„One-way‟
ActorSystem(“goticks”)ActorSystem(“goticks”)
REST Interface
BoxOffice
Event(“RHCP”, 250)
{ event: “RHCP” nrOfTickets: 250}
Inside RestInterface…
boxOffice ! event
Receiver can respond
to „sender‟
Send Event
To BoxOffice
ActorSystem(“goticks”)ActorSystem(“goticks”)
REST Interface
BoxOffice
EventCreated
Inside BoxOffice…
sender ! EventCreated
Respond with
EventCreated,
results in OK
HTTP OK
ActorSystem(“goticks”)ActorSystem(“goticks”)
REST Interface
BoxOffice
{ event: “RHCP” nrOfTickets: 250}
BuyTicket
TicketSeller
Inside BoxOffice…
ticketSeller forward BuyTicket
Get a Ticket
Forward keeps sender
(RestInterface)
TicketRequest(“RHCP”)
ActorSystem(“goticks”)ActorSystem(“goticks”)
REST Interface
BoxOffice
{ event: “RHCP”, nr :1}
TicketSeller
Inside TicketSeller…
sender ! ticket
Respond to
original senderBuyTicketTicket(“RHCP”, 1)
CODE
Questions?
@RayRoestenburg
rroestenburg@xebia.com
www.xebia.com
github.com/RayRoestenburg/xebicon
Backup slides
“Async sending subscription
data”
Send
Thread X
Consumer
Consumer
Consumer
Thread 1
Thread 2
Thread 1
Service A
Send
Thread X
Consumer
Consumer
Consumer
Thread 1
Thread 2
Thread 1
Service A
Thread 2 fails
Send
Thread X
Consumer
Consumer
Consumer
Thread 1
Thread 2
Thread 1
Service A
Thread 2 fails
Handle every possible error
inside Thread 2, never fail?
Not completely under your control.
Send
Thread X
Consumer
Consumer
Consumer
Thread 1
Thread 2
Thread 1
Service A
Thread 2 fails
Restart / Stop?
Monitor?
Handle errors
across all subscriptions?
4. Supervise*
Untangle behavior and errors
„Just Reboot‟
Let It Crash ™
Error Kernel
4. Supervise*
Strategies
One for One
(Poison Pill /Seppuku)
All for One
4. Supervise*
val supervisorStrategy =
OneForOneStrategy(maxNrOfRetries = 5,
withinTimeRange = 1 minute) {
case _: Exception => Restart
}
4. Supervise*
val supervisorStrategy =
OneForOneStrategy(maxNrOfRetries = 5,
withinTimeRange = 1 minute) {
case _: Exception => Restart
}
Restart,
Resume,
Escalate,
Stop,

More Related Content

What's hot

Decorators in Python
Decorators in PythonDecorators in Python
Decorators in PythonBen James
 
The Swift Compiler and Standard Library
The Swift Compiler and Standard LibraryThe Swift Compiler and Standard Library
The Swift Compiler and Standard LibrarySantosh Rajan
 
2. Design patterns. part #2
2. Design patterns. part #22. Design patterns. part #2
2. Design patterns. part #2Leonid Maslov
 
JavaScript Functions
JavaScript FunctionsJavaScript Functions
JavaScript FunctionsColin DeCarlo
 
Decorators Explained: A Powerful Tool That Should Be in Your Python Toolbelt.
Decorators Explained: A Powerful Tool That Should Be in Your Python Toolbelt.Decorators Explained: A Powerful Tool That Should Be in Your Python Toolbelt.
Decorators Explained: A Powerful Tool That Should Be in Your Python Toolbelt.Samuel Fortier-Galarneau
 
FITC Web Unleashed 2017 - Introduction to the World of Testing for Front-End ...
FITC Web Unleashed 2017 - Introduction to the World of Testing for Front-End ...FITC Web Unleashed 2017 - Introduction to the World of Testing for Front-End ...
FITC Web Unleashed 2017 - Introduction to the World of Testing for Front-End ...Haris Mahmood
 
An Introduction to the World of Testing for Front-End Developers
An Introduction to the World of Testing for Front-End DevelopersAn Introduction to the World of Testing for Front-End Developers
An Introduction to the World of Testing for Front-End DevelopersFITC
 
Google Guava for cleaner code
Google Guava for cleaner codeGoogle Guava for cleaner code
Google Guava for cleaner codeMite Mitreski
 
GR8Conf 2011: GPars
GR8Conf 2011: GParsGR8Conf 2011: GPars
GR8Conf 2011: GParsGR8Conf
 
Web Optimization Summit: Coding for Performance
Web Optimization Summit: Coding for PerformanceWeb Optimization Summit: Coding for Performance
Web Optimization Summit: Coding for Performancejohndaviddalton
 
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STMConcurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STMMario Fusco
 
Swift Programming Language
Swift Programming LanguageSwift Programming Language
Swift Programming LanguageGiuseppe Arici
 
Zope component architechture
Zope component architechtureZope component architechture
Zope component architechtureAnatoly Bubenkov
 
Google guava - almost everything you need to know
Google guava - almost everything you need to knowGoogle guava - almost everything you need to know
Google guava - almost everything you need to knowTomasz Dziurko
 
Swift internals
Swift internalsSwift internals
Swift internalsJung Kim
 
Functional Programming Patterns (NDC London 2014)
Functional Programming Patterns (NDC London 2014)Functional Programming Patterns (NDC London 2014)
Functional Programming Patterns (NDC London 2014)Scott Wlaschin
 
Currying and Partial Function Application (PFA)
Currying and Partial Function Application (PFA)Currying and Partial Function Application (PFA)
Currying and Partial Function Application (PFA)Dhaval Dalal
 
Advanced Javascript
Advanced JavascriptAdvanced Javascript
Advanced JavascriptAdieu
 

What's hot (20)

Google guava
Google guavaGoogle guava
Google guava
 
Decorators in Python
Decorators in PythonDecorators in Python
Decorators in Python
 
The Swift Compiler and Standard Library
The Swift Compiler and Standard LibraryThe Swift Compiler and Standard Library
The Swift Compiler and Standard Library
 
2. Design patterns. part #2
2. Design patterns. part #22. Design patterns. part #2
2. Design patterns. part #2
 
JavaScript Functions
JavaScript FunctionsJavaScript Functions
JavaScript Functions
 
Decorators Explained: A Powerful Tool That Should Be in Your Python Toolbelt.
Decorators Explained: A Powerful Tool That Should Be in Your Python Toolbelt.Decorators Explained: A Powerful Tool That Should Be in Your Python Toolbelt.
Decorators Explained: A Powerful Tool That Should Be in Your Python Toolbelt.
 
FITC Web Unleashed 2017 - Introduction to the World of Testing for Front-End ...
FITC Web Unleashed 2017 - Introduction to the World of Testing for Front-End ...FITC Web Unleashed 2017 - Introduction to the World of Testing for Front-End ...
FITC Web Unleashed 2017 - Introduction to the World of Testing for Front-End ...
 
An Introduction to the World of Testing for Front-End Developers
An Introduction to the World of Testing for Front-End DevelopersAn Introduction to the World of Testing for Front-End Developers
An Introduction to the World of Testing for Front-End Developers
 
Google Guava for cleaner code
Google Guava for cleaner codeGoogle Guava for cleaner code
Google Guava for cleaner code
 
GR8Conf 2011: GPars
GR8Conf 2011: GParsGR8Conf 2011: GPars
GR8Conf 2011: GPars
 
Web Optimization Summit: Coding for Performance
Web Optimization Summit: Coding for PerformanceWeb Optimization Summit: Coding for Performance
Web Optimization Summit: Coding for Performance
 
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STMConcurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
 
Swift Programming Language
Swift Programming LanguageSwift Programming Language
Swift Programming Language
 
Python decorators
Python decoratorsPython decorators
Python decorators
 
Zope component architechture
Zope component architechtureZope component architechture
Zope component architechture
 
Google guava - almost everything you need to know
Google guava - almost everything you need to knowGoogle guava - almost everything you need to know
Google guava - almost everything you need to know
 
Swift internals
Swift internalsSwift internals
Swift internals
 
Functional Programming Patterns (NDC London 2014)
Functional Programming Patterns (NDC London 2014)Functional Programming Patterns (NDC London 2014)
Functional Programming Patterns (NDC London 2014)
 
Currying and Partial Function Application (PFA)
Currying and Partial Function Application (PFA)Currying and Partial Function Application (PFA)
Currying and Partial Function Application (PFA)
 
Advanced Javascript
Advanced JavascriptAdvanced Javascript
Advanced Javascript
 

Similar to Akka in-action

Buiilding reactive distributed systems with Akka
Buiilding reactive distributed systems with AkkaBuiilding reactive distributed systems with Akka
Buiilding reactive distributed systems with AkkaJohan Andrén
 
Akka Actors: an Introduction
Akka Actors: an IntroductionAkka Actors: an Introduction
Akka Actors: an IntroductionRoberto Casadei
 
First glance at Akka 2.0
First glance at Akka 2.0First glance at Akka 2.0
First glance at Akka 2.0Vasil Remeniuk
 
Scalaz 8 vs Akka Actors
Scalaz 8 vs Akka ActorsScalaz 8 vs Akka Actors
Scalaz 8 vs Akka ActorsJohn De Goes
 
Clojure concurrency
Clojure concurrencyClojure concurrency
Clojure concurrencyAlex Navis
 
Exception handling poirting in gcc
Exception handling poirting in gccException handling poirting in gcc
Exception handling poirting in gccShiva Chen
 
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.0Knoldus Inc.
 
Concurrency on the JVM
Concurrency on the JVMConcurrency on the JVM
Concurrency on the JVMVaclav Pech
 
Let'swift "Concurrency in swift"
Let'swift "Concurrency in swift"Let'swift "Concurrency in swift"
Let'swift "Concurrency in swift"Hyuk Hur
 
A gentle introduction into AKKA and the actor model
A gentle introduction into AKKA and the actor modelA gentle introduction into AKKA and the actor model
A gentle introduction into AKKA and the actor modelMykhailo Kotsur
 
Hadoop Summit Europe 2014: Apache Storm Architecture
Hadoop Summit Europe 2014: Apache Storm ArchitectureHadoop Summit Europe 2014: Apache Storm Architecture
Hadoop Summit Europe 2014: Apache Storm ArchitectureP. Taylor Goetz
 
Concurrent programming with Celluloid (MWRC 2012)
Concurrent programming with Celluloid (MWRC 2012)Concurrent programming with Celluloid (MWRC 2012)
Concurrent programming with Celluloid (MWRC 2012)tarcieri
 
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 modelMassimo Bonanni
 
Introduction to Actor Model and Akka
Introduction to Actor Model and AkkaIntroduction to Actor Model and Akka
Introduction to Actor Model and AkkaYung-Lin Ho
 
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 remedykrivachy
 
Advanced akka features
Advanced akka featuresAdvanced akka features
Advanced akka featuresGrzegorz Duda
 
Testing akka-actors
Testing akka-actorsTesting akka-actors
Testing akka-actorsKnoldus Inc.
 

Similar to Akka in-action (20)

Buiilding reactive distributed systems with Akka
Buiilding reactive distributed systems with AkkaBuiilding reactive distributed systems with Akka
Buiilding reactive distributed systems with Akka
 
Akka Actors: an Introduction
Akka Actors: an IntroductionAkka Actors: an Introduction
Akka Actors: an Introduction
 
First glance at Akka 2.0
First glance at Akka 2.0First glance at Akka 2.0
First glance at Akka 2.0
 
Scalaz 8 vs Akka Actors
Scalaz 8 vs Akka ActorsScalaz 8 vs Akka Actors
Scalaz 8 vs Akka Actors
 
Akka (BeJUG)
Akka (BeJUG)Akka (BeJUG)
Akka (BeJUG)
 
Clojure concurrency
Clojure concurrencyClojure concurrency
Clojure concurrency
 
Exception handling poirting in gcc
Exception handling poirting in gccException handling poirting in gcc
Exception handling poirting in gcc
 
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
 
Concurrency on the JVM
Concurrency on the JVMConcurrency on the JVM
Concurrency on the JVM
 
Let'swift "Concurrency in swift"
Let'swift "Concurrency in swift"Let'swift "Concurrency in swift"
Let'swift "Concurrency in swift"
 
A gentle introduction into AKKA and the actor model
A gentle introduction into AKKA and the actor modelA gentle introduction into AKKA and the actor model
A gentle introduction into AKKA and the actor model
 
Hadoop Summit Europe 2014: Apache Storm Architecture
Hadoop Summit Europe 2014: Apache Storm ArchitectureHadoop Summit Europe 2014: Apache Storm Architecture
Hadoop Summit Europe 2014: Apache Storm Architecture
 
Concurrent programming with Celluloid (MWRC 2012)
Concurrent programming with Celluloid (MWRC 2012)Concurrent programming with Celluloid (MWRC 2012)
Concurrent programming with Celluloid (MWRC 2012)
 
Akka and futures
Akka and futuresAkka and futures
Akka and futures
 
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
 
Introduction to Actor Model and Akka
Introduction to Actor Model and AkkaIntroduction to Actor Model and Akka
Introduction to Actor Model and Akka
 
Current State of Coroutines
Current State of CoroutinesCurrent State of Coroutines
Current State of Coroutines
 
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
 
Advanced akka features
Advanced akka featuresAdvanced akka features
Advanced akka features
 
Testing akka-actors
Testing akka-actorsTesting akka-actors
Testing akka-actors
 

Recently uploaded

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 

Akka in-action

Editor's Notes

  1. TODOMake specific to Rabo -> Scala Java comparison.Show basic powerful features of Scala anyone would love. (REPL, case classes, pattern matching, collectionsVery simple example of Futures. Very simple example of Actor. Very simple example of Agent?
  2. The free lunch is over. (Actually it has been over for a while now!)This graph is from an article by Herb Sutter of C++ fame.While the number of transistors per chip still increases, the clock speed has leveled out over the last coupld of years.Chip manufacturers focus on multi core abilities instead of higher clock speeds.So new chips will not immediately increase the speed of sequential programs.This means that concurrent programs are necessary to make full use of multi-core CPU’s
  3. Can’t I just get these really smart compiler and runtime guys to do parallelization behind the scenes?Gimme that shiny box!Released in 2018? I kid.
  4. Some part of your application is going to be sequential, which limits the improvement that can be achieved by parallel execution.Algorithms that require very low sequential execution can benefit the most from parallel execution.Example: Map Reduce style (batch) processing
  5. ThreadsAn standalone execution path within a process - Has its own timeline- Call Stack- Shares Address space (Heap) with other Threads within the same process Performance improvement degrades with more threads than cores.Knowing up front which locks need to be locked Breaks encapsulationAll locks need to be taken before modification - in the correct orderAll locks must be unlocked Thread are expensive and their lifecycle management is error prone Traditional problem: Dining Philosophers
  6. ThreadsAn standalone execution path within a process - Has its own timeline- Call Stack- Shares Address space (Heap) with other Threads within the same process Performance improvement degrades with more threads than cores.Knowing up front which locks need to be locked Breaks encapsulationAll locks need to be taken before modification - in the correct orderAll locks must be unlocked Thread are expensive and their lifecycle management is error prone Traditional problem: Dining Philosophers
  7. Threads do not compose, or interact using exceptions, they all have their own stacktrace.Communicating between threadgroups is not possible using traditional exceptions. Roll your own.You will need to use concurrent data structures to communicate with the threads, like queues for instance.
  8. Can’t I just get these really smart compiler and runtime guys to do parallelization behind the scenes?Gimme that shiny box!
  9. Event driven – The world is event drivenScalable – use both more cores and nodesAsynchronous – Waiting is a bad way to use processing cycle. Life is too short to block.Resilient – More robust and easier failure handling of concurrent and distributed systems
  10. Single Node, Single ThreadLMAX Disruptor, runs on one thread, achieves 100.000 tpsNode.Js (Javascript is singlethreaded) But what if that one thread blocks, or fails..Scale up by just running more processes, but how do you coordinate concurrency?Processes are heavier than threads, and maybe there is even something lighter…Many Nodes, Single ThreadedCombine the single thread processes with some kind of network communication, Like 0MQ, RabbitMQ, ..MQ. Distributed Coordination can be done with a distributed database, or something like Apache Zookeeper.Which are all technologies that live on a diffferent planet, which you will have to master. If need be OK, but this is getting complex.Single Node, Many ThreadsWhat if we just use java.util.concurrent? Concurrent data structures, directly using Threads, locks, semaphores? How hard can deadlocks, livelocks, thread starvation, race conditions really be to debug?Many Nodes, Many Threads.A combination of even more technologies?
  11. Today we are only going to talk about actors, unless we have time left.
  12. One at a time. Sequential in the small. Concurrent and Async in large numbers.
  13. At Restart the new actor instance gets to handle next messages.There is an option to handle the message that was being processed during the crash.
  14. Today we are only going to talk about actors, unless we have time left.
  15. Today we are only going to talk about actors, unless we have time left.
  16. Today we are only going to talk about actors, unless we have time left.
  17. A Service sends subscription based messages using traditional Network I/O. Async because one consumer must not block others. Below Subscription X type messages are sent to consumers.Threads do not compose, or interact using exceptions, they all have their own stacktrace.Communicating between threadgroups is not possible using traditional exceptions. Roll your own.You will need to use concurrent data structures to communicate with the threads, like queues for instance.You can’t guarantee that a thread will be able to handle all possible errors itself, without knowing information about the bigger system or larger context.(network usage policy, behavior of consumer across subsystems could mean the difference between cutting the consumer off, or restarting transmissions To a different endpoint)
  18. A Service sends subscription based messages using traditional Network I/O. Async because one consumer must not block others. Below Subscription X type messages are sent to consumers.Threads do not compose, or interact using exceptions, they all have their own stacktrace.Communicating between threadgroups is not possible using traditional exceptions. Roll your own.You will need to use concurrent data structures to communicate with the threads, like queues for instance.You can’t guarantee that a thread will be able to handle all possible errors itself, without knowing information about the bigger system or larger context.(network usage policy, behavior of consumer across subsystems could mean the difference between cutting the consumer off, or restarting transmissions To a different endpoint)
  19. A Service sends subscription based messages using traditional Network I/O. Async because one consumer must not block others. Below Subscription X type messages are sent to consumers.Threads do not compose, or interact using exceptions, they all have their own stacktrace.Communicating between threadgroups is not possible using traditional exceptions. Roll your own.You will need to use concurrent data structures to communicate with the threads, like queues for instance.You can’t guarantee that a thread will be able to handle all possible errors itself, without knowing information about the bigger system or larger context.(network usage policy, behavior of consumer across subsystems could mean the difference between cutting the consumer off, or restarting transmissions To a different endpoint)
  20. A Service sends subscription based messages using traditional Network I/O. Async because one consumer must not block others. Below Subscription X type messages are sent to consumers.Threads do not compose, or interact using exceptions, they all have their own stacktrace.Communicating between threadgroups is not possible using traditional exceptions. Roll your own.You will need to use concurrent data structures to communicate with the threads, like queues for instance.You can’t guarantee that a thread will be able to handle all possible errors itself, without knowing information about the bigger system or larger context.(network usage policy, behavior of consumer across subsystems could mean the difference between cutting the consumer off, or restarting transmissions To a different endpoint)