What is Protocol Buffers?

Protocol buffers (Protobuf) is a Google project used to easily and efficiently serialize structured data so that it can be transmitted over a wire or stored in files.

Protobuf is more optimized for scenarios where the data is transmitted between multiple micro-services in a platform-neutral way. This is why developers often prefer Protobuf when serializing data.

Protobuf > JSON

Protobuf is faster than JSON and XML. This is because it removes many responsibilities usually done by data formats and focuses only on serializing and deserializing data as fast as possible.

The definition of data to be serialized is written in configuration files called proto files with the extension .proto. These files contain the configuration known as messages.

Key features

  • Binary transfer format

The data is transmitted as binary. This improves the speed of transmission more than raw string because it takes less space and bandwidth.

  • Separation of context and data

In JSON and XML, the data in context are not separable, whereas in Protobuf, it is separable.

  • Message format

As discussed before, the data is transmitted as Protobuf based on a configuration file known as messages.

Free Resources