Kryo is a fastest and efficient way to do serialization. It is more efficient than Java serialization – both in size and speed.
I am working on a Scala_Lift_Akka based project, where I have to implement serializer for Akka Actor’s remoting. Since Kryo is fast, efficient and easy to use, so I decided to implement Kryo in my project for serialization.
I implemented Romix’s kryo-based serialization library, which is excellent and easy to use.
Since above library is not compatible with Scala 2.10, so I used Akka-Kryo-Serializer_with Scala 2.10.
This kryo-based serializer supports all scala classes such as Option, Tuple, Enumeration etc. If you are using any other types except Scala types, such as net.liftweb.common.Box then you need to customize this serializer.
I have added a custom serailizer of net.liftweb.common.Box for my scenario. If you have such scenario, where you need to serialize other data-types except Scala types, then you would have to add serializer for that data type in below manner:
After that, you have to give reference of this serializer in ‘getKryo’ method of ‘KryoSerializer.scala’
Above approach works well for my scenario. If you have any better approach, please suggest.
Your suggestion would be highly appreciable.