Before Protobuf, lets have a look at what role does serialization play in Akka.
The messages that Akka actors send to each other are JVM objects (e.g. instances of Scala case classes). Message passing between actors that live on the same JVM is straightforward. It is simply done via reference passing. However, messages that have to escape the JVM to reach an actor running on a different host have to undergo some form of serialization (i.e. the objects have to be converted to and from byte arrays).
Akka itself uses Protocol Buffers to serialize internal messages (i.e. cluster gossip messages).
However, the serialization mechanism in Akka allows you to write custom serializers and to define which serializer to use for what.
But why should we really use this Protobuf Serialization?
As we all know, Java serialization is the default in Akka which is pretty bad for us because of the…
View original post 792 more words