Usage Recommendations

You learned to create actors, send messages to them, and also how to coordinate between multiple instances. You used a stateless actor and also a stateful actor. You used both one-way communication and two-way communication. These options may seem a bit overwhelming. Let’s explore some recommendations for good use.

  • Rely more on stateless actors instead of stateful actors. Stateless actors don’t have identity, they can provide more concurrency, they’re easy to replicate, and they’re easy to restart and reuse. State may not be avoidable, but keep the use of stateful actors to a minimum—use them sparingly.

  • Keep the processing in the receive method really fast, especially if the receiving actor is stateful. Long-running tasks ...

Get Pragmatic Scala now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.