The objective of this post is to understand the differences between the Akka Actors and Go Channels and how they are related to each other.
Both Akka Actors and Go Channels describe independent ways to communicate independent process via message passing.
Akka actors implement the Actor model (Hewitt, 1973).
In the Actor model, the communication between two independent processes is completely decoupled. Message delivery is not confirmed to the sender and may take an arbitrary amount of time. The result of this is that Actors will be more independent from each other as they can choose when to handle a message based on internal state. The disadvantage is that Actors require to buffer messages and a mailbox of theoretically unbounded size.
The advantage of Akka Actors is that because the message passing is decoupled, it becomes trivial to run processes in different network nodes. It allows the receiver to be offline and not to receive the message without affecting the sender as the sender wont wait for getting a reply.
Go Channels implements the paper Communicating sequential processes (Hoare, 1978).
In Go Channels, a message exchange is synchronous with a “touch point” of the execution. Processes hand over messages one to another.
Go programs usually deal with different checks for messages not to block the program from making progress. Channels are really useful for processing concurrent sequential jobs in a controlled environment (e.g. Single VM with multiple cores), enabling the developer to build a correct program, scalable and with a parallel design.
While Akka Actors are more useful to use in a distributed computing with fault tolerance because of the capability to decouple producer and consumer, consequently is not possible to write data-driven synchronised structures.
It can be applied to build Trading and Gaming systems but not applicable for lock-step data-driven flow control of robotics.
Go gets the best of both approaches and is more general than the Actor model. In Go you communicate your processes by messaging over a channel inside your controlled environment. And If you want to use Go channels in a distributed environment, checkout Go Circuit framework.