Actor Model vs Master Worker micro talk @JUGRoma Nov2013
-
Upload
egherardini -
Category
Technology
-
view
147 -
download
1
description
Transcript of Actor Model vs Master Worker micro talk @JUGRoma Nov2013
![Page 1: Actor Model vs Master Worker micro talk @JUGRoma Nov2013](https://reader035.fdocuments.in/reader035/viewer/2022062617/54b7afc34a7959cf688b4572/html5/thumbnails/1.jpg)
Patterns for Concurrent Reactive Process Design
by
Emanuele Gherardini
Actor Modelvs
Master Worker
![Page 2: Actor Model vs Master Worker micro talk @JUGRoma Nov2013](https://reader035.fdocuments.in/reader035/viewer/2022062617/54b7afc34a7959cf688b4572/html5/thumbnails/2.jpg)
Agenda
Who am I (aka disclaimer)
Why on the earth should we care about this stuff ?!
The stuff…
![Page 3: Actor Model vs Master Worker micro talk @JUGRoma Nov2013](https://reader035.fdocuments.in/reader035/viewer/2022062617/54b7afc34a7959cf688b4572/html5/thumbnails/3.jpg)
Who am I == !(Who I am not)
! Joshua Bloch
! Robert Martin
! Kent Beck
! Martin Fowler
! Martin Odersky ! Brian Goetz
![Page 4: Actor Model vs Master Worker micro talk @JUGRoma Nov2013](https://reader035.fdocuments.in/reader035/viewer/2022062617/54b7afc34a7959cf688b4572/html5/thumbnails/4.jpg)
Who I am… Really ^_-
31 Years old Software Engineer
Always a passionate and enthusiast student…
6 years of professional experience
Working @ Ringmaster:System Architect of the GTech Gaming Platform
![Page 5: Actor Model vs Master Worker micro talk @JUGRoma Nov2013](https://reader035.fdocuments.in/reader035/viewer/2022062617/54b7afc34a7959cf688b4572/html5/thumbnails/5.jpg)
Who I am… Really ^_-
DO NOT BELIEVE ME(try it!)
![Page 6: Actor Model vs Master Worker micro talk @JUGRoma Nov2013](https://reader035.fdocuments.in/reader035/viewer/2022062617/54b7afc34a7959cf688b4572/html5/thumbnails/6.jpg)
Why should I care? Cloudy reasons…
http://www.reactivemanifesto.org/
We (devs) now have great tools…
![Page 7: Actor Model vs Master Worker micro talk @JUGRoma Nov2013](https://reader035.fdocuments.in/reader035/viewer/2022062617/54b7afc34a7959cf688b4572/html5/thumbnails/7.jpg)
The question is…
Do we know how to use them ?
Probably not…
![Page 8: Actor Model vs Master Worker micro talk @JUGRoma Nov2013](https://reader035.fdocuments.in/reader035/viewer/2022062617/54b7afc34a7959cf688b4572/html5/thumbnails/8.jpg)
Super-Simple-Use-Case: online tickets
![Page 9: Actor Model vs Master Worker micro talk @JUGRoma Nov2013](https://reader035.fdocuments.in/reader035/viewer/2022062617/54b7afc34a7959cf688b4572/html5/thumbnails/9.jpg)
Master-WorkerWorkers are stateless+ Self-tunable+ Dynamic scalable+ Resilient
- Shared mutable state requires LOCKS
Worker‘eventZ’request
Queue Worker
Worker‘eventX’request
‘eventY’request
‘eventX’request
‘eventY’request
‘eventZ’request
Implementation tips: ride the Camel!(and your preferred distributed messaging infrastructure)
1 – Create your route
2 – Configure it to be local or distributed
![Page 10: Actor Model vs Master Worker micro talk @JUGRoma Nov2013](https://reader035.fdocuments.in/reader035/viewer/2022062617/54b7afc34a7959cf688b4572/html5/thumbnails/10.jpg)
Actor-Model
‘eventZ’request
‘eventX’request
‘eventY’request
‘eventX’request
‘eventY’request
‘eventZ’request
Business Logic
MailBox
Actor
Implementation tips: Akka
Actors are stateful+ Shared Mutable State does not exist: no need for complex concurrency-aware logic.
- Load should bepartitioned at design time if possible (or implemented using Router-Actors, etc)
![Page 11: Actor Model vs Master Worker micro talk @JUGRoma Nov2013](https://reader035.fdocuments.in/reader035/viewer/2022062617/54b7afc34a7959cf688b4572/html5/thumbnails/11.jpg)
Comparison: which is the best?
The best results come from choosing the concurrency model by the business process.
Near-stateless, heavely loaded, business processes Master-Worker
Statefull business processes Actor-Model
It depends…
![Page 12: Actor Model vs Master Worker micro talk @JUGRoma Nov2013](https://reader035.fdocuments.in/reader035/viewer/2022062617/54b7afc34a7959cf688b4572/html5/thumbnails/12.jpg)
THANKS
Questions?