2

Possible Duplicate:
Good use case for Akka

I understand why using the AKKA actors framework for embarrassing parallel problems makes sense.

What about problems that don't involve heavy computation and don't need to parallelised at all but are still highly distributed. For example, thousands of distributed clients who can increment or decrement a specific counter?

Community
  • 1
  • 1
dublintech
  • 16,815
  • 29
  • 84
  • 115

2 Answers2

4

Besides the obvious distributability and scalability arguments there are other aspects which are really nice about actors.

  • The actor model allows the complete decoupling between message passing and error handling; these two are tightly woven together in traditional OO. When you call a method, you get the return value but you must also handle all possible errors. When you send a message to an actor, you only get the response back, while all failures are handled by the actor’s supervisor.

  • Another nice thing is the improved encapsulation: in “normal” OO you’ll typically see too many things exposed on an object, and if not you can still go in using reflection. Akka actors are completely encapsulated (unless you cheat by sending around “this” references), nobody messes with the state but the actors themselves.

  • Tying into the previous point, the fact that message reception is the only entry point into an actor’s behavior makes them much easier to reason about than normal OO code, where each public (or protected) method may be used as an entrance. You don’t need these invocations to be concurrent in order to miss unplanned interactions.

Roland Kuhn
  • 15,412
  • 2
  • 36
  • 45
3

Actors are a model of computation that lends itself to both distribution and concurrency (and ultimately parallelism) (due to isolation and message passing). So Actors can be used where you only have 1 thread of execution on one single machine, or thousands of threads of execution over thousands of machines.

Viktor Klang
  • 26,479
  • 7
  • 51
  • 68
  • but what would AKKA Actors be any better than just simple RPC communictation for something that took the Server very little time to process: e.g. incrementing a counter? Is there distributed use case where AKKA Actors will make very little difference. – dublintech Oct 19 '12 at 12:59
  • RPC is just broken: http://steve.vinoski.net/blog/2008/07/01/convenience-over-correctness/ – Viktor Klang Oct 21 '12 at 13:52