akka-persistence and serialization

722 views
Skip to first unread message

Eric Swenson

unread,
Feb 4, 2016, 6:57:36 PM2/4/16
to akka...@googlegroups.com
Since upgrading to akka 2.4.2-RC2, I’m seeing the following warning on startup:

background log: info: [WARN] [02/04/2016 15:21:46.414] [ClusterSystem-akka.actor.default-dispatcher-25] [akka.serialization.Serialization(akka://ClusterSystem)] Using the default Java serializer for class [org.xxx.eim.ExperimentInstance$RegisterProxySucceededEvent] which is not recommended because of performance implications. Use another serializer or disable this warning using the setting 'akka.actor.warn-about-java-serializer-usage'

I’ve looked at the documentation here:  http://doc.akka.io/docs/akka/snapshot/java/serialization.html but can find no documentation on what serialization implementations are recommended or what factors to consider when choosing a serialization implementation. I’m not really keen on having to write my own serializer, nor in adding serialization methods to each of the objects used in akka-persistence. What are the recommendations here?  

— Eric

Patrik Nordwall

unread,
Feb 5, 2016, 1:51:54 AM2/5/16
to akka...@googlegroups.com
Documentation related to persistence and serialization:

For remote messages I would use something more automatic, such as Kryo.

Regards,
Patrik

--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



--

Patrik Nordwall
Typesafe Reactive apps on the JVM
Twitter: @patriknw

Paul Cleary

unread,
Feb 5, 2016, 9:13:14 AM2/5/16
to Akka User List
Eric,
The implications of java serialization are the following:

1. It is slow to serialize and deserialize relative to other means
2. You cannot run a mixed bag.  If you have a type User that is version1, and then you change the User to be version2, if you serialize using something like akka persistence, or try to read the byte array into a User instance, your application will break.

For your application, you might not care about either of these.  If you don't have to deserialized from a stored state, then 2 wouldn't be an issue for you.

If you aren't a high throughput type of setup, then 1 may not be a concern as well.

You can quiet that setting `akka.actor.warn-about-java-serializer-use = off` (I think)

Guido Medina

unread,
Feb 5, 2016, 9:35:33 AM2/5/16
to Akka User List
Or, you can use something like Kryo which is kind of straight forward and very fast compared to Java serialization, for the lazy here is a quick snippet for your application conf:

akka {
  extensions
= ["com.romix.akka.serialization.kryo.KryoSerializationExtension$"]

  actor
{
    serializers
.java = "com.romix.akka.serialization.kryo.KryoSerializer"

    kryo
{
      type
= "nograph"
      idstrategy
= "default"
      serializer
-pool-size = 1024
      kryo
-reference-map = false
   
}
 
}
}


For more information on Kryo visit their project homepage: https://github.com/romix/akka-kryo-serialization

HTH,

Guido.
Reply all
Reply to author
Forward
0 new messages