Search code examples
javaserializationupgradebackwards-compatibilitythrift

Data format compatibility between Thrift versions


I am trying to upgrade a system that uses Thrift 0.2 libraries for communication. Since this is rather old version (latest stable is 0.5), and there have been alleged significant improvements to performance (in 0.4) I was hoping to upgrade. However, I could not find information regarding whether there have been incompatible changes to underlying data format. Based on versioning scheme, one would hope there was not; but since these are still pre-1.0 versions, maybe there is less expectation for stability.

The reason I am hoping to learn that data format itself was backwards compatible is that it would allow upgrades to components to occur one by one.

Anyway: I was hoping that someone with more information could point me to right documentation.


Solution

  • ... instead of using byte[] as the underlying data type for binary fields, we’ve switched to using ByteBuffer. The means that we can avoid doing unnecessary byte array allocation and copies during deserialization. This approach is a full 2.5x times faster than the old way, and that’s not even accounting for the reduction in garbage collection time. You’ll definitely have to make some code changes to get the upgrade, but you should still find it worthwhile.

    Taken from "Thrift 0.4.0 Released" document. Related changes in the source code: "Switch binary field implementation from byte[] to ByteBuffer".