|
|
|
|
|
by weltmeister
1549 days ago
|
|
Imho its not so much the actor pattern but the single writer principle. actors are a tool which is not to used solely. Need encapsulate state? Actors can help. Need concurrency? Perhaps futures are a better fit. the question you ask is problatic at it sees actors as a single solution. |
|
So even though Go has this green/micro thread behavior behind the scenes (go routines), it’s main innovation is around the concurrency safe queue (the channel) so those threads can communicate.
Now with actors you can imagine more of a pattern where each holds its own state and messages cause them to modify themselves or send messages to other actors. This behaves more like AI in a game simulation and is useful if independence rather than coordination is a good solution to the problem.
For lots of services this is not the case as the fastest path through all the queues is the best path and the problem isn’t about deciding what to do independently or hiding state within the actor but throughput through known paths. So that’s the difference. If you are tagging video with ML you want queues and throughput, if you are reacting to routing networking messages based on simple rules (erlang) you want actors.