7. Actors
● Primitive unit of computation
● Keeps state private - no shared state
● Process one message at a time
● No locks on the state
● Lightweight object
● Communication via message passing
● Supervision
● Distributed by design
8. Akka - Áhkká, also known in its
"Swedified" form Akka, is a
massif in the southwestern
corner of Stora Sjöfallet National
Park in northern Sweden.
9. Akka - Toolkit and runtime for building
highly concurrent, distributed,
and resilient message-driven
applications on the JVM
10. Akka
Toolkit
● Has several modules
● And counting...
Concurrent
● Thousands of actors in one machine running
at the same time
Distributed
● Actors can live locally or remote
● Can be clustered
Resilient
● Every actor has a supervisor
● They choose what to do when s@#t happens
11. Akka
● Actor Implementation
● Seamless Remoting
● Java, Scala
● High performance
● Micro Service toolkit
● Fault tolerant (Supervision strategies)
● Easily Scalable
● Event driven architecture
14. Behaviour on Message
● Alter internal state
● Reply sender or Send message
● Report error to supervisor
● Create child actors
● Terminate
15. Actor Reference
● Reference to the actor
● ActorRef can be passed around
● Internal state and methods are hidden
● Unique Address (filesystem like)
16. Hierarchy
● Parent - Child relation
● Supervision
● Choose to Restart, Resume, Stop children
18. Cluster
A cluster is a group of resources that
are trying to achieve a common
objective, and are aware of one
another.
19. Load Balancer
A Load Balancer is responsible for
distributing incoming network traffic
across a group of same kind and setup
of backend servers. Can be both
within a cluster or set of servers
which are unaware of each other.
20. Application Clustering and Load Balancing
● Clustering also involves load balancing
● Clustering shares the state
● Load balancing is more infra than cluster is more app side
● Clustering is harder to setup
● Clustering is more scalable
● From failure-client perspective, when error occurs LB will lose the request,
Cluster can retry on other cluster members
21. Comparison
Clustering
● Load Balancing
● Shares the state
● Aware of other servers
● Requires application setup
● Harder to setup
● Will retry on other nodes when error
happens
● More scalable
Load Balancing
● Load Balancing
● Keeps state private
● Unaware of others
● Requires infra setup
● Easy to deploy
● Lose info when error occurs
23. Akka Cluster
Akka Cluster provides a fault-tolerant
decentralized peer-to-peer based
cluster membership service with no
single point of failure or single point
of bottleneck. It does this using gossip
protocols and an automatic failure
detector.
24. Akka Cluster
Cluster Membership
● Aware of who is on the cluster
● Let actors to join/leave cluster
Fault tolerant - Failure
Detector
● Aware of who is reachable/unreachable
No Single Point of
Failure
● Messages can be routed to set actors
Gossip Protocol
● Send random actors about the actors observed
● Update cluster state based on messages
25. Akka Cluster
● Gossip-Based Cluster Membership
● Failure Detector
● Cluster Aware Routers
● Metrics
● Load balancing and routing (round-robin, adaptive to metrics)
● Distributed Data (experimental)