Home

Protocolbuffers

Protocol Buffers, commonly referred to as protobuf, is a language-neutral, platform-neutral data serialization format developed by Google. It provides a compact binary representation of structured data and is designed for high performance and forward/backward compatibility. It is defined by a .proto schema file that describes the data structures and service interfaces.

A schema defines message types with fields assigned unique numeric tags. Each field has a type (such

Protobuf supports maps, enumerations, and nested message types. Proto3 simplifies the syntax by removing required fields,

The binary wire format uses varint encoding and field tags to achieve compact size and fast parsing.

Protobuf is typically used with the protoc compiler to generate code in languages such as C++, Java,

Advantages include compactness, speed, and strong typing; limitations include lack of self-describing data and potential schema

as
int32,
string,
bool,
bytes,
or
a
nested
message),
a
label
(optional,
repeated,
or
required
in
proto2),
and
a
field
number.
The
compiler
generates
source
code
in
various
languages
to
parse
and
construct
messages.
making
fields
optional
by
default,
and
not
supporting
extensions.
It
introduces
oneof
for
mutually
exclusive
fields
and
map
fields
for
associative
arrays.
The
format
is
designed
to
be
backward
and
forward
compatible:
unknown
fields
are
ignored
on
parsing
but
can
be
preserved
in
some
implementations,
and
new
fields
can
be
added
with
new
numbers.
Python,
Go,
C#,
Ruby,
and
JavaScript.
It
is
widely
used
with
gRPC,
a
high-performance
RPC
framework
that
uses
protobuf
to
define
service
interfaces
and
payloads.
drift
if
field
numbers
are
reused.
Alternatives
include
JSON-based
formats
or
other
IDL-based
systems
like
FlatBuffers
or
Cap'n
Proto.