Protobuf is a binary data format which is more efficient than JSON or XML
JSON, XML are quite verbose and require a lot of data to sent.
JSON and XML may also be slow to parse or create
Protobuff uses its own binary protocol for transferring data. It has some of its own field types for non negative numbers which reduce byte size.
It has a language independent schema declaration which looks a bit like a C struct. In the schema you define the structure of the message.
You then use a compile to compile the schema into the language of your choice and use that code in your serialisation and deserialisation of the message.
The end effect is that all of the faster can be faster:
serialization
deserialization
transfer of message
At Google you can spend 10% of your week doing experimental software development and this protobuf project came from that
A message schema (struct) and its message looks like:
Note that a compiler is used to compile the proto shema into code which works with your language choice. You can then integrate that generated code into your project.
The schema declares field types and whether they are mandatory or optional. It allows for the definition of enums.
Not shown in this example, but it is possible to embed message schema definitions within another message schema definition.
If you are doing backend service to backend service and there is no need to see the JSON or XML then you can increase performance by using protobuf
Back: Overview of Tech
Page Author: JD