Serialization Technologies Rest, Avro, Thrift, Grpc, MessagePack
Representational state transfer is the software architecture used for web services. RESTful web services provide computer systems and internet, work together. According to the rest, API clients and servers are separated from each other. The server doesn’t keep any information about the client, so it’s stateless. They have a uniform interface and are loosely coupled, like the way we want in microservices. They have a layered system. They can also extend the functionality of clients temporarily on demand. A RESTful web application provides information about its resources. Resources are identified with the help of URLs.
- For Apache Thrift please checkout Apache Thrift and Spring Boot
- For protocol buffers please checkout GRPC Spring Boot Tutorial
- For Apache, Avro please checkout Kafka, Apache Avro, and Confluent Platform with Spring Boot
- For MessagePack please checkout MessagePack Tutorial with Spring Boot
But what is the best serialization technology and how are we going to decide it?. It depends on our software and architecture. If we use protocol buffers or Apache Thrift, we should go on using them, because it will be risky to change the code infrastructure. Or if we use JSON, we should continue with JSON but we should consider using MessagePack for optimization purposes. Avro should be used if we are dealing with big data.
The famous companies, using serialization technologies, may give us a clue about choosing the right technology :
- Apache Thrift: Facebook, Cassandra
- Protocol Buffers: Google, ActiveMQ,
- Apache Hadoop: Avro
Avro Protocol Buffers have better documentation when compared with Apache Thrift. Protocol Buffers are slightly faster. Avro differs from these systems in the following fundamental aspects Dynamic typing, Untagged data, No manually-assigned field ID. For more please check Apache Avro
There is a sample benchmarking for thrift-protobuf-avro and you can get the document from BenchmarkingV2.wiki. There are also serialization and deserialization performances.
Thanks for reading.