Cross platform actors
Introducing cross platform actor support between Go and C#.
Can I use this?
The Go implementation is still in beta, there are users using Proto Actor for Go in production already.
But be aware that the API might change over time until 1.0.
Sourcecode - Go
This is the Go repository for Proto Actor.
The C# implementation can be found here https://github.com/AsynkronIT/protoactor-dotnet
Design principles:
Minimalistic API -
The API should be small and easy to use.
Avoid enterprisey JVM like containers and configurations.
Build on existing technologies - There are already a lot of great tech for e.g. networking and clustering, build on those.
e.g. gRPC streams for networking, Consul.IO for clustering.
Pass data, not objects - Serialization is an explicit concern, don't try to hide it.
Protobuf all the way.
Be fast - Do not trade performance for magic API trickery.
Ultra fast remoting, Proto Actor currently manages to pass over two million messages per second between nodes using only two actors, while still preserving message order!
This is six times more the new super advanced UDP based Artery transport for Scala Akka, and 30 times faster than Akka.NET.
:> node1.exe
2016/12/02 14:30:09 50000
2016/12/02 14:30:09 100000
2016/12/02 14:30:09 150000
... snip ...
2016/12/02 14:30:09 900000
2016/12/02 14:30:09 950000
2016/12/02 14:30:10 1000000
2016/12/02 14:30:10 Elapsed 999.9985ms
2016/12/02 14:30:10 Msg per sec 2000003 <--
History
As the creator of the Akka.NET project, I have come to some distinct conclusions while being involved in that project.
In Akka.NET we created our own thread pool, our own networking layer, our own serialization support, our own configuration support etc. etc.
This was all fun and challenging, it is however now my firm opinion that this is the wrong way to go about things.
If possible, software should be composed, not built, only add code to glue existing pieces together.
This yields a much better time to market, and allows us to focus on solving the actual problem at hand, in this case concurrency and distributed programming.
Proto Actor builds on existing technologies, Protobuf for serialization, gRPC streams for network transport.
This ensures cross platform compatibility, network protocol version tolerance and battle proven stability.
Another extremely important factor here is business agility and having an exit strategy.
By being cross platform, your organization is no longer tied into a specific platform, if you are migrating from .NET to Go,
This can be done while still allowing actor based services to communicate between platforms.
Reinvent by not reinventing.
Why Actors
- Decoupled Concurrency
- Distributed by default
- Fault tolerance
For a more indepth description of the differences, see this thread Actors vs. CSP
Building
You need to ensure that your $GOPATH
variable is properly set.
Next, install the standard protocol buffer implementation and run the following commands to get all the necessary tooling:
go get github.com/AsynkronIT/protoactor-go/...
cd $GOPATH/src/github.com/AsynkronIT/protoactor-go
go get ./...
make
After invoking last command you will have generated protobuf definitions and built the project.
Windows users can use Cygwin to run make: www.cygwin.com
Testing
This command exectutes all tests in the repository except for consul integration tests (you need consul for running those tests). We also skip directories that don't contain any tests.
go test `go list ./...