Which is the best alternative for Java Serialization?

It’s 2011, and in a commercial grade REST web services project we use the following serializers to offer clients a variety of media types:

  • XStream (for XML but not for JSON)
  • Jackson (for JSON)
  • Kryo (a fast, compact binary serialization format)
  • Smile (a binary format that comes with Jackson 1.6 and later).
  • Java Object Serialization.

We experimented with other serializers recently:

  • SimpleXML seems solid, runs at 2x the speed of XStream, but requires a bit too much configuration for our situation.
  • YamlBeans had a couple of bugs.
  • SnakeYAML had a minor bug relating to dates.

Jackson JSON, Kryo, and Jackson Smile were all significantly faster than good old Java Object Serialization, by about 3x to 4.5x. XStream is on the slow side. But these are all solid choices at this point. We’ll keep monitoring the other three.

Leave a Comment