Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data serialization framework

I'm new to this Apache Avro(serialization framework). I know what serialization is but why there are separate frameworks lik avro, thrift, protocol buffers and

  1. Why cant we use java serialization api's instead of these separate frameworks, are there any flaws in java serializatio api's.

  2. What is the meaning of below phrase "does not require running a code-generation program when a schema changes" in avro or in any other serializatio framework.

Please help me to understand all these!!

like image 342
pramav Avatar asked Jan 10 '13 12:01

pramav


People also ask

What is a data serialization framework?

Data serialization is the process of converting an object into a stream of bytes to more easily save or transmit it. The reverse process—constructing a data structure or object from a series of bytes—is deserialization.

What are two popular methods of data serialization?

XML , JSON , BSON, YAML , MessagePack, and protobuf are some commonly used data serialization formats.

What is data serialization example?

Serialization encodes objects into another format. For example you have an array in PHP like this: $array = array("a" => 1, "b" => 2, "c" => array("a" => 1, "b" => 2));

What is the difference between JSON and serialization?

JSON is a format that encodes objects in a string. Serialization means to convert an object into that string, and deserialization is its inverse operation (convert string -> object). If you serialize this result it will generate a text with the structure and the record returned.


1 Answers

Why cant we use java serialization api's instead of these separate frameworks, are there any flaws in java serializatio api's.

I would assume you can use Java Serialization unless you know otherwise.

The main reasons not to use it are

  • you know there is a performance problem.
  • you need to exchange data across languages. Java Serialization is only for Java.

does not require running a code-generation program when a schema changes

I am guessing this means it can read serialized data with an older or newer model without having to re-generate and compile the code. i.e. it is tolerant of changes in the model.

BTW: As the data models I work with are usually a) very simple b) require maximum performance, I write my own Serialization without using a framework (or write my own framework) This is fine provided your model is very simple and won't change often.

In short, unless you know you can't, try Java Serialization first.

A comparison I did on different Serialization Methods

like image 188
Peter Lawrey Avatar answered Sep 18 '22 15:09

Peter Lawrey