10 Lessons From Implementing The Actor Model • Vagif Abilov • GOTO 2023

Learn practical lessons from implementing the Actor Model, a scalable and flexible approach to concurrency and parallel processing, covering key concepts and best practices for building robust and performant systems.

Key takeaways
  • Don’t use object-oriented programming to model interactions, only describe the behavior and avoid complex logic.
  • Begin with simple non-clustered actor model and then migrate to a clustered model as complexity grows.
  • Ensure that events are processed in a sequential manner to avoid conflicts.
  • Use tell (one-way messaging) instead of ask (request-response) messaging to prevent the actor from blocking.
  • Keep actor persistence simple and avoid using a single actor to handle multiple responsibilities.
  • Model real-world processes and interactions as accurately as possible.
  • Actors are great as finite state machines, each actor has its own state and handle events accordingly.
  • Use supervision to monitor actor failures and implement automatic recovery.
  • Don’t create singletons or cluster singletons without good reasons.
  • Leave active worker actors and use them consistently.
  • Avoid cluster singletons and use a strategy such as static quorum to manage conflicts.
  • Use consistent hashing to distribute actors across nodes and ensure scalability.
  • Make actors self-managed and reactive, allowing them to adapt to changing circumstances.
  • Avoid using ask (request-response) messaging and instead use tell (one-way messaging) for better performance.
  • Use a simple and performant model to handle concurrency and parallel processing.
  • Use eventsourcing to persist actor state and ensure data consistency.
  • Implement failover and redundancy to ensure system availability and resilience.
  • Program actors to take care of themselves and don’t expect to control them directly.
  • Don’t overcomplicate the model and keep it simple and performant.
  • Apply domain-driven design principles to model real-world processes and interactions.
  • Avoid using object-oriented programming to model interactions and instead describe the behavior.