A Tour of Advanced Akka Features in 60
- Slides: 95
A Tour of (Advanced) Akka Features in 60 Minutes [CON 1706] Johan Janssen, Info Support @johanjanssen 42
Content ▪ Why Akka? ▪ Sharding ▪ Local actor ▪ Persistence ▪ Remote actor ▪ Akka HTTP ▪ Scheduling ▪ Finite State Machines ▪ Cluster ▪ Conclusion ▪ Routing ▪ Questions ▪ Cluster singleton
Why Akka?
Why Akka? ▪ Concurrent ▪ Scalable ▪ Fault tolerant ▪ More natural programming experience when connecting to other systems ▪ Easy to use?
i a l c s i D r e m
Local actor
Local actor Actor on JVM 1
Local actor Coordinator Actor Hello conference
Local actor Coordinator Actor println("Hello conference")
class Worker extends Actor { def receive = { case x => println(x) } } Scala val system = Actor. System("Example. Actor. System") val worker. Actor. Ref = system. actor. Of(Props[Worker]) worker. Actor. Ref ! "Hello conference"
Remote actor
Remote actor Actor on JVM 1 Actor on JVM 2
val worker. Actor. Ref = system. actor. Of(Props[Worker]) worker. Actor. Ref ! "Hello conference" val worker. Actor. Ref = context. actor. Selection("akka. tcp: // Example. Actor. System@127. 0. 0. 1: 9005 /user/worker. Actor") worker. Actor. Ref ! "Hello conference"
akka { actor { provider = "akka. remote. Remote. Actor. Ref. Provider" } remote { enabled-transports = ["akka. remote. netty. tcp"] netty. tcp { hostname = "127. 0. 0. 1" port = 9002
Remote actor Start. Message Hello conference Coordinator actor Worker actor
Remote actor Coordinator actor Worker. Message Greetings from the coordinator: Hello Conference Worker actor
Remote actor Coordinator actor Worker. Response Message Item processed successfully Worker actor
Scheduling
Scheduling Tick Scheduled once after 1 second system. scheduler. schedule. Once(1 seconds, schedule. Receive. Actor, Tick) Tock Scheduled every 5 seconds system. scheduler. schedule(0 seconds, 5 seconds, schedule. Receive. Actor, Tock) Actor
Scheduling ▪ Does not work for fixed point in time like 17: 00 – Use Quartz
Cluster
Cluster Actor. System on JVM 2 Actor. System on JVM 1 Actor. System on JVM 3 Actor. System on JVM 4
Seed nodes ▪ Contact points for automatically joining a cluster
akka { cluster { seed-nodes = [ "akka. tcp: //Cluster. Node@127. 0. 0. 1: 2551", "akka. tcp: //Cluster. Node@127. 0. 0. 1: 2552" ] } }
Cluster Worker Node Port 2551 Association failed with [akka. tcp: //Cluster. System@127. 0. 0. 1: 2552
Cluster Member Up with IP: 127. 0. 0. 1 and port: 2551 Member Up with IP: 127. 0. 0. 1 and port: 2552 Worker Node Port 2552
Cluster Member Up with IP: 127. 0. 0. 1 and port: 2550 Coordinator Node Port 2550 Member Up with IP: 127. 0. 0. 1 and port: 2550 Worker Node Port 2551 Worker Node Port 2552
Cluster Coordinator Node Port 2550 Register. Worker Node Port 2551 Register. Worker Node Port 2552
Cluster Coordinator Node Port 2550 Worker registered with IP: 127. 0. 0. 1 and port: 2551 Worker registered with IP: 127. 0. 0. 1 and port: 2552 Worker Node Port 2551 Worker Node Port 2552
Routing
Routing Actor on JVM 2 Actor on JVM 1 Actor on JVM 3 Loadbalancer Actor on JVM 4
akka { actor { provider = "akka. cluster. Cluster. Actor. Ref. Provider" } } deployment { /coordinator/router { router = round-robin-pool nr-of-instances = 10 routees. paths = ["/user/emptystringactor"] cluster { enabled = on allow-local-routees = off } } }
Routing "" Coordinator Actor on JVM 1 Empty. String Actor on JVM 2 Empty. String Actor on JVM 3 Empty. String Actor on JVM 4
Routing "" Coordinator Actor on JVM 1 Hash. Map[hostname, counter] Empty. String Actor on JVM 2 Empty. String Actor on JVM 3 Empty. String Actor on JVM 4
Routing Empty. String Actor on JVM 2 Coordinator Actor on JVM 1 "" Empty. String Actor on JVM 3 Empty. String Actor on JVM 4
Routing Empty. String Actor on JVM 2 Coordinator Actor on JVM 1 Empty. String Actor on JVM 3 "" Empty. String Actor on JVM 4
Cluster singleton
Cluster singleton ▪ Only one instance of the actor in the cluster ▪ (Re)created on the oldest node ▪ Can be used for instance for scheduling/caching
Cluster singleton Actor on JVM 1 Singleton actor and other actors on JVM 2 Other actors on JVM 3 Other actors on JVM 4
Cluster singleton "" Coordinator Empty. String Actor on JVM 2 Empty. String Actor on JVM 3 Empty. String Actor on JVM 4
Cluster singleton "" Coordinator Hash. Map[hostname, counter] Empty. String Actor on JVM 2 Empty. String Actor on JVM 3 Empty. String Actor on JVM 4
Cluster singleton "" Coordinator Empty. String Actor on JVM 2 Empty. String Actor on JVM 3 Empty. String Actor on JVM 4
Cluster singleton "" Coordinator Hash. Map[hostname, counter] Empty. String Actor on JVM 2 Empty. String Actor on JVM 3 Empty. String Actor on JVM 4
Cluster singleton Coordinator Empty. String Actor Crashon JVM 2 Empty. String Actor on JVM 3 Empty. String Actor on JVM 4
Cluster singleton Coordinator "" Empty. String Actor on JVM 3 Empty. String Actor on JVM 4
Cluster singleton Coordinator "" Hash. Map[hostname, counter] Empty. String Actor on JVM 3 Empty. String Actor on JVM 4
Cluster singleton Coordinator "" Empty. String Actor on JVM 3 Empty. String Actor on JVM 4
Cluster singleton Coordinator "" Hash. Map[hostname, counter] Empty. String Actor on JVM 3 Empty. String Actor on JVM 4
Sharding
Sharding ▪ Dividing a set of actors over a cluster ▪ Actors will be divided into groups called shards ▪ It will divide based on a logical identifier
Sharding 0, 2, 4, 6, 8 Actor on JVM 1 1, 3, 5, 7, 9 even Shard on JVM 2 odd Shard on JVM 3
Persistence
Persistence ▪ Store actor information ▪ Recover after crash ▪ Possibility to take snapshots
Example without persistence Actor Cobol
Example without persistence Actor Cobol
Example without persistence Actor Cobol
Example without persistence Actor Java Cobol
Example without persistence Actor Crash Cobol Java Restart
Example without persistence Actor
Example without persistence Actor Scala
Example without persistence Actor Scala
Persistence Journal Command Cobol Persistent. Actor
Persistence Journal Persistent. Actor Cobol Event
Persistence Journal Persistent. Actor ACK Cobol Event
Persistence Journal Persistent. Actor Cobol Event
Persistence Journal Persistent. Actor Cobol Event Java Event
Persistence Journal Crash Persistent. Actor Cobol Java Restart Cobol Event Java Event
Persistence Journal Persistent. Actor Cobol Event Java Event
Persistence Journal Persistent. Actor Scala Cobol Java Cobol Event Java Event
Persistence Journal Persistent. Actor Cobol Java Scala Cobol Event Java Event
Snapshots Snapshot store Persistent. Actor State until Event C++ Journal Cobol C++
Snapshots Snapshot store Persistent. Actor State until Event C++ Journal Cobol C++
Snapshots Snapshot store State until Event C++ Persistent. Actor Journal Cobol C++
Snapshots Snapshot store Journal Persistent. Actor State until Event C++ Java Cobol C++
Snapshots Snapshot store State until Event C++ Persistent. Actor Journal Cobol C++ Java Crash Restart
Snapshots Snapshot store State until Event C++ Persistent. Actor Journal Cobol C++ Java
Snapshots Snapshot store State until Event C++ Persistent. Actor Cobol C++ Journal Cobol C++ Java
Snapshots Snapshot store State until Event C++ Persistent. Actor Cobol C++ Java Journal Cobol C++ Java
Snapshots Snapshot store State until Event C++ Persistent. Actor Cobol C++ Java Scala Journal Cobol C++ Java
Akka HTTP
Akka HTTP Actor on JVM 1 Actor on JVM 2
Finite State Machine
Finite State Machine ▪ State ▪ Event
Finite State Machines (FSM) Progress, iteration Crappy Project New Project No. Progress, 2 Progress, iteration Inprogress Project
Finite State Machines (FSM) Iteration: 0 New Project Crappy Project Work harder Inprogress Project
Finite State Machines (FSM) Iteration: 0 New Project Good job! Crappy Project Inprogress Project
Finite State Machines (FSM) Iteration: 0 New Project Wrong direction Crappy Project Inprogress Project
Finite State Machines (FSM) Iteration: 0 New Project Use Akka Crappy Project Inprogress Project
Finite State Machines (FSM) Iteration: 1 New Project Good job! Crappy Project Inprogress Project
Finite State Machines (FSM) Iteration: 1 New Project Wrong direction Crappy Project Inprogress Project
Finite State Machines (FSM) Iteration: 1 New Project Use Akka Crappy Project Inprogress Project
Finite State Machines (FSM) Iteration: 2 New Project Crappy Project Get another job! Inprogress Project
Conclusion
Conclusion ▪ Akka can be used with Scala or Java ▪ There is even a. NET version of Akka ▪ Akka is really powerful ▪ Akka is quite easy to use ▪ Some features are still experimental
Questions Johan Janssen @johanjanssen 42 Git. Hub: https: //github. com/johanjanssen/Akka-examples
- Tour escort jobs
- Bad world tour
- Shanghai world financial tour eiffel tours petronas
- Akka
- Akka mitarbeiterangebote
- Pohjan neidot
- Akka net github
- Akkamahadevi university student portal
- Poison control.aspx?gameserver=
- Akka frakt
- Advanced python features
- Esa multimedia.esa.int./multimedia/virtual-tour-iss
- Tour guiding module
- Virtual plant cell
- Virtual tour of a synagogue
- Russian czar who took an 18 month tour of england
- Tour eiffel le touquet
- Tipos de operadores turísticos
- Audio tour guide app development
- Tour teks observasi
- Tour fitoplancton cartagena
- Tour de flex
- Combien de ballon pour soulever un homme
- Tour of body.com
- Tour leader course
- Tour manager checklist
- Laim tour
- Http://teacher.scholastic.com/activities/immigration/tour/
- Nazareth virtual tour
- Eco prospecting
- Tbilisi honeymoon packages
- Protistes supérieurs
- Repetitive nearest neighbor algorithm
- Fort valley state university dorm tour
- Mit nuclear reactor tour
- Llln
- Role play tourist guide
- Study tour introduction
- Microsoft datacenter tour
- Alison weir tours
- Knight's tour
- Tour de france landes
- Seeking information about admission procedure formal letter
- Ltape
- Viaduc de la tour sur orb
- Describe the community which you belong
- Eiffeltoren frans
- Diane kuehn
- Eiffel
- Virtual bus tour
- Tour guide presentation
- Joanna cobley
- Tour operator liability
- Google tour builder app
- Tour de matour
- How to make hypothesis in quantitative research
- Euler tree
- Scholastic interactive tour of ellis island
- Travel agency business plan examples
- Shrine of remembrance virtual tour
- Tourism grade 12 term 1
- Visio isometric
- Anatomy of journey
- Windows vista tour
- Menganalisis struktur dan kebahasaan teks lho
- A guided tour to approximate string matching
- Joe burrus
- Tour de table
- Carte mentale le tour du monde en 80 jours
- Tour manager system
- Virtual tour sarthe
- Contoh announcement study tour
- Intercellular connections
- Acquaintanceship graph
- Euler tour
- Eiffel
- Vedutismo camera ottica
- Overland adalah
- Tour de france 2007 route kent
- Python revision tour 1
- What-does-tourist-guide-do
- Bo gallant
- Warwick castle virtual tour
- Gif tour eiffel
- Arbre palier turbine tour de refroidissement
- Georges de la tour magdalen
- Tour leader course
- A tour of the cell chapter 4
- Georges de la tour magdalena
- A guided tour to approximate string matching
- How to welcome a tourist
- Tour the collectives of cyberspace
- Phraséologie tour de piste
- Imperialists vs. anti-imperialists
- Virtual tour of old trafford
- La tour de hanoi