Systems & Backend

Protocol Buffers

also: protobuf

A compact, schema-first binary serialization format from Google — the payload behind gRPC.

Protocol Buffers (protobuf) is a binary serialization format where you define your data’s schema in a .proto file and a compiler generates typed encode/decode code for many languages. The wire format is small and fast, and it is the default payload for gRPC.

Worked example: a message defined as { int64 id = 1; string name = 2; } encodes to a few compact bytes (field numbers, not names, go on the wire), versus the verbose JSON with full field names. Gotcha: the field NUMBERS are the contract, not the names — you can rename a field freely but must never reuse or change a field number, and to stay backward-compatible you only add new optional fields; break those rules and old and new services silently misread each other’s data.