Our Python install took 6 seconds and its build passed in 1 second, while tests were skipped and pip-audit found 2 known vulnerabilities. Use Protocol Buffers if independently deployed services need a shared, typed message contract. Skip it if your main requirement is exchanging readable, loosely structured JSON and you don't want to maintain schemas and generated code. The official overview describes typed messages across languages.
What people use protobuf for
Google uses Protocol Buffers for communication between servers and archival storage on disk, according to the official overview. Protobuf turns a schema, a definition of message fields and types, into code for reading and writing those messages. That makes it useful when a writer and a reader belong to different applications or use different languages.
| Who used it | What they did | What you can take from the result |
|---|---|---|
| Used it extensively for server communication and archival storage, according to the project overview | Stored messages make compatibility a continuing responsibility. | |
| Harshil Jani | Used Protobuf during a 2023 Google Summer of Code project on the Qaul.net peer-to-peer messenger, as he describes in his serialization article | A concrete messenger integration, rather than a claim that every messaging application needs it. |
| GitHub commenter ngbrown | Used proto2 presence checks to broadcast only changed fields, as described in issue #1606 | An absent value meant unchanged, rather than reset to the default. |
| X user 0xlelouch_ | Migrated a Go backend with more than 15 microservices to shared schemas and gRPC, reporting lower payload size, serialization CPU use and inter-service tail latency in their migration account | The migration changed the transport as well as serialization, so the gains belong to that combined change. |
The last example is the kind of story that makes Protobuf attractive. It also makes a poor promise to your own team. Changing JSON to Protobuf while also adopting gRPC changes several parts of a request at once. Buy the shared contract because you need it, then measure whether the new path improves your application.
What happened when we ran it
Our November 20, 2026 hands-on attempt failed to start a deployment: the runner required a Compose file and found none. The failure lists all four filenames it searched: compose.yaml, compose.yml, docker-compose.yaml and docker-compose.yml. The runner called this an "unsafe repo". That label describes its deployment rule, not a security finding about Protobuf.
The run summary labels the attempt as a deployment using the project's own Docker Compose, with ports bound to localhost. The failed prerequisite contradicts that label, so it cannot support a successful deployment claim. The run header dates the attempt, and teardown returned ok. A serialization library doesn't need a Compose stack to be useful. This runner chose the wrong deployment prerequisite for evaluating it.
We ran the Python project under ./python/ at commit 8ae1b29 on October 8, 2026. Our harness selected that Python path and recorded the setup steps below. In our recorded run, installation succeeded in 6 seconds with 38 dependencies and 101 MB on disk. The build then succeeded in 1 second. The next step stopped being a correctness check: the harness found no tests script or target and skipped tests.
| October sandbox observation | Recorded result | Meaning for your decision |
|---|---|---|
| Install | Succeeded in 6 seconds | The Python setup step completed. |
| Build | Succeeded in 1 second | The selected Python build step completed. |
| Tests | No tests script or target, skipped | No passing-test count came from this run. |
| Dependencies and installed footprint | 38 dependencies, 101 MB | This is the measured Python environment. |
| pip-audit | 2 known vulnerabilities | An audit finding about that environment, not an attribution to a particular package. |
| Checkout | 3,706 files, about 1,280,033 source lines, 103.9 MB | The checkout is broader than the selected Python path. |
| Discovery scan | 24 CI workflow files, no Dockerfile, no tests directory | These are harness discovery results, not an inventory of every upstream testing mechanism. |
The recorded sandbox configuration specifies 3 CPUs, 8 GB RAM and image ghcr.io/astral-sh/uv:python3.12-bookworm. That image name is a configuration label. Actual runtime and operating-system versions require the toolchain logs. The useful finding is a short successful Python setup, followed by skipped tests, rather than a measured serialization result.
Where people get stuck: imports, presence and missing domain types
A generated Python module can fail at import time even after schema compilation succeeds, as the reporter demonstrates in issue #1491. Their generated b_pb2.py imports a_pb2, but importing it through the generated package produces ImportError: No module named 'a_pb2'. The reporter shows a relative import that works for that layout. Another commenter says they manually edited generated files.
That distinction belongs in your evaluation: generating a file and importing the installed package are separate checks. A manual change to generated code also needs repeating after regeneration. Before spreading schemas across repositories, exercise the import path your application actually uses from its packaged distribution, rather than only from a source folder.
| Report | What the discussion says | Practical response and resolution boundary |
|---|---|---|
| Python imports, #1491 | Absolute generated imports fail in the demonstrated package layout. | The reporter demonstrates a relative-import workaround. The closed thread excerpt ends without a general shipped packaging remedy. |
| Scalar presence, #1606 | Users need to distinguish missing values from explicitly supplied defaults such as zero. | Wrappers and oneof appear as historical workarounds. The current overview documents proto3 optional for explicit presence. |
| Decimal, #4406 | bugproof describes manual C# decimal conversions; tephe says decimal use obstructs migration. | Commenters discuss strings and bytes, and a maintainer links a proposal. Closure alone supplies no implemented Decimal type. |
| UUID, #2224 | Users want one shared UUID representation; proposed encodings include strings and integer fields. | The discussion contains designs and byte-order concerns. Choose and document a representation across your consumers instead of treating the proposals as a shipped type. |
Presence is especially easy to underestimate. In ngbrown's broadcast application, an omitted field meant the previous value should stay. Setting it to zero was a different instruction. If your updates have those semantics, select presence deliberately. A scalar's default value cannot carry both meanings by itself.
Decimal and UUID discussions expose another cost: a schema gives you agreement only after you agree on representation. For decimal-heavy business software, that includes precision, scale and conversion rules. For identifiers, it includes the byte order when you choose a binary representation. Treat those decisions as part of the interface review.
At volume, integer decoding and copies can hurt
Khavel_dev reports reducing deserialization time by 40% after changing selected uint32 fields to fixed32 in a gRPC service handling about 50,000 messages per second. That is their r/dotnet report, not our benchmark. It is useful because it points to a specific cost: decoding variable-length integers in large arrays with non-uniform values.
A varint stores an integer using a variable number of bytes. A fixed-width integer spends a fixed amount of space instead. The official encoding guide describes both encodings. Smaller messages and cheaper decoding are different goals. The best representation depends on your values and the runtime doing the work, so include both typical values and awkward distributions in a benchmark.
Don't turn that Reddit change into a blanket migration instruction. The official best-practices guide warns against changing field types. An existing field is already an agreement with deployed readers and stored data. A new schema can choose types freely; an established interface needs a compatibility plan.
Copies can matter as much as arithmetic. In open C++ issue #1896, bobobo1618 describes a gRPC and RocksDB database server where parsing and serialization consume about 30% of response time. They want to store received bytes and forward stored messages without reconstructing objects. The request concerns avoiding that work, so the presence of a stream API is not an answer by itself.
Schema changes have to survive old readers
Never reuse a field number after deleting a field: the official best-practices guide says to reserve it. A field number identifies data on the binary wire, and old messages may survive in logs or storage long after a deployment. Reusing that number can give old bytes a new meaning.
Deprecating a field should therefore start with finding its readers and writers. When you remove the definition, keep its number reserved. The Editions guide also recommends reserving deleted names for the text and JSON representations. A tidy sequence of consecutive field numbers is a bad reason to renumber a message already in use.
Forwarding deserves a separate acceptance check. In historical issue #272, jeremyong describes accumulating message diffs for clients that may be offline, and objects to losing unknown fields. An older service being able to read a newer message is different from preserving its unfamiliar fields for a newer client. The test you want sends a new field through the older intermediary, through storage if applicable, and back to a reader that knows its meaning.
Security includes where bytes are allocated
FSMaxB reports that sensitive key material in bytes fields bypassed their secure arena allocator and landed in heap-allocated strings, in the open zero-copy discussion, #1896. An arena groups memory allocations, but that report shows why choosing one isn't enough to conclude that every field uses your intended allocator.
If your reason for choosing a runtime includes controlled key storage, inspect the allocation path for the actual field type. The security property you need is where the sensitive bytes live and what happens when that memory is released. A compact wire format says nothing about that property.
Our October pip-audit result was 2 known vulnerabilities. The audit summary lacks package names, advisory identifiers and severity, so it cannot assign those findings to Protobuf itself. Before adopting that exact environment, obtain the detailed audit output and review the affected dependencies. Schema types also leave application rules to you: a parsed string still needs whatever validation your domain requires.
Protobuf vs JSON, Avro, MessagePack and buffer formats
Protobuf vs JSON is a choice about schema obligations and how you inspect messages, as well as payload size. The Protobuf Explained page describes readable JSON keys and Protobuf's field-number encoding. Keep JSON when those readable exchanges are valuable and shared generated types would add more work than they remove.
| Option | Why you would choose it | What the comparison actually supports |
|---|---|---|
| JSON | Human-readable messages and easy inspection with general JSON tools. | Protobuf Explained contrasts visible field names with schema-dependent binary decoding. There is no universal speed ratio here. |
| Apache Avro | Evaluate it when your data pipeline needs its schema approach. | In SoftwareMill's Java library-record benchmark, Protobuf wins serialization/deserialization speed while Avro produces smaller records. The author explicitly limits the comparison to that Java setup. |
| MessagePack | Consider it when you want binary data with fewer schema and compilation obligations. | In r/softwarearchitecture, sennalen favors that flexibility while Remarkable-Art-8404 prefers Protobuf's explicit contract. These are developers' preferences. |
| FlatBuffers | Evaluate direct access to serialized data when unpacking is the cost you want to avoid. | The FlatBuffers README documents access without parsing or unpacking first. That design difference supplies a reason to compare, not a measured speed win here. |
| Cap'n Proto | Include it in a workload comparison if you are examining alternatives to repeated encoding and decoding. | A r/softwarearchitecture participant reports favorable experience with FlatBuffers and Cap'n Proto depending on tradeoffs. That is an anecdote. |
| gRPC | Use an RPC framework when the job includes calling remote procedures. | Protobuf defines and serializes messages; gRPC supplies RPC functionality. They are complementary components, as the overview explains. |
Protobuf vs Avro needs a benchmark in your language, with your records. Protobuf vs gRPC needs a component diagram: changing the message format and the RPC transport together does not isolate either one's effect. In the r/node comparison discussion, alexp702 asks for data transferred, simple versus complex data and proxies. Those are sensible questions for any headline claiming one stack beats another.
What the other reviews get wrong
SoftwareMill's 2023 Avro comparison omits Editions when it describes the schema-language choices as proto2 and proto3. The official Editions guide covers Editions 2023 and 2024. That corrects the language-version description, without claiming a particular package release is current.
Dan Silber's Streamdal article, Comparing Avro vs Protobuf for Data Serialization, describes serialized Protobuf as purely binary. The Protobuf Explained page also documents a standardized JSON mapping. Binary is the encoding relevant to its field-number and payload tradeoffs, rather than the only representation available.
The Streamdal article also makes compilation with protoc sound unavoidable across every implementation. That fits the official generated-code workflow, but protobuf.js supports loading schemas without protoc. In r/dotnet, klaxxxon describes a C# code-first approach that derives its wire format at runtime. Neither example removes the need to agree on message structure.
The practical gRPC video calls Protobuf compressed. The official overview explicitly says messages are not compressed. Compact serialization and compression are separate operations.
Two more details matter when you design numeric fields. The Python tutorial's repeated-tag explanation needs qualification: packed primitive repeated fields share a length-delimited record, with applicable packing on by default starting in Edition 2023, according to the encoding reference. And Zeeterm's r/dotnet comment understates the space for a negative int32. The same encoding reference says negative intN values require ten bytes. Its ZigZag encoding discussion explains why sint32 can suit small negative values.
Questions people ask
Protobuf means Protocol Buffers, Google's system for defining and serializing structured messages, according to the official overview.
What does Protobuf mean, and what does its format look like?
Protocol Buffers uses numbered, typed fields defined in .proto files. The overview's Person example gives name, id and email their own field numbers. Generated code reads and writes the values as bytes. The schema supplies the meaning of those numbers, so retain it alongside any archived data you expect to interpret later.
How does Protobuf compare with JSON for speed and payload size?
There is no single speed or size advantage that this review can promise for your application. SoftwareMill's Java benchmark finds different winners for speed and size, while the integer-array discussion shows how scalar choices can affect decoding costs within Protobuf itself. Compare identical payloads and hold transport and compression constant before using the result to justify migration.
What does the same data look like in JSON and Protobuf?
JSON includes field names in readable text; Protobuf binary uses field numbers interpreted through the schema. The Protobuf Explained walkthrough makes that distinction. The presenter of Protocol Buffers Crash Course builds a JavaScript employee list and shows a 125-byte JSON file for three employees before starting the Protobuf version. That observation is the presenter's example, not our payload measurement.
How can I decode Protobuf data, and what can I recover without its schema?
A Protobuf decoder needs the matching schema to fully interpret a message, according to the official overview. The encoding guide explains field numbers and wire types, which help inspect raw structure. They don't recover the original field names or application meaning. Ask for the .proto definition before treating decoded-looking bytes as understood data.
How do I use Protobuf in JavaScript with protobufjs?
protobuf.js is an independently maintained JavaScript implementation for Node.js and browsers. Its README documents loading a schema, looking up a message type, encoding and decoding, without requiring protoc. It also says encoding doesn't implicitly check plain-object input. Use its explicit validation or conversion methods when your input's shape isn't already guaranteed.
Where is the Protobuf GitHub repository, and where can I find working examples?
The Protobuf GitHub repository is protocolbuffers/protobuf, and its README points to the examples directory and language tutorials. The official tutorial index provides complete sample code. Start with the example for your consumer's language so the generation and runtime steps match the application you intend to ship.
How do I install, build, and start using Protobuf?
The root README separates the protoc compiler from the runtime for your chosen language. It recommends supported releases and provides prebuilt compiler binaries for non-C++ users. The Python README recommends the protobuf package. Installing a runtime and generating code for a new schema are separate tasks. Local serialization needs no hosted API account.
How do I define, compile, serialize, and parse Protobuf messages in Python?
The official Python tutorial walks through an address-book application: define messages in a .proto file, run the compiler and use the generated Python API to write and read messages. Keep package imports in that exercise too. The Python README excludes direct setup.py builds from the GitHub checkout. It gives Bazel wheel targets for source-package work.
How do I deprecate or delete a Protobuf field safely?
Reserve a deleted field's number so nobody reuses it, as the best-practices guide directs. The Editions guide recommends reserving its name too. Account for stored messages and consumers that can roll back. Removing a reference from today's server code doesn't remove yesterday's serialized data.
How do I use oneof, including multiple independent oneofs in one message?
A oneof groups fields so at most one is set at a time, as the overview describes. In issue #1606, xfxyjwf explains that fields in separate oneofs still share the parent message's naming scope. Give each field a distinct name and number, rather than restarting the numbering inside each group.
What is gRPC, how does it differ from Protobuf, and how do they work together?
Protobuf supplies message definitions and serialization; gRPC supplies remote procedure calls. The official overview describes their common pairing, and the Protobuf explainer video shows encoding and decoding before recommending an RPC option. You can use Protobuf for a file on disk without introducing an RPC service.
Should I choose Protobuf or Avro for my workload?
Choose by your consumers, schema workflow and measured costs. SoftwareMill's Java comparison uses library records containing books and authors and finds Protobuf faster for serialization/deserialization while Avro produces smaller records. That tradeoff is a reason to compare your own records. It doesn't tell a Python application which implementation will win.
What we have not tested yet
Our successful October steps cover Python setup at 8ae1b29, with tests skipped; the November Compose prerequisite prevented an application exercise. We have no serialization throughput, payload-size comparison, round-trip correctness result, compiler-build result or production workload from our own runs. We also lack the raw logs needed to identify actual runtime versions and the two audit advisories. The November run header's deployment wording is not substantiated by a deployment step.
The employee-list video's transcript ends before a final Protobuf size or speed result. Harshil Jani's article establishes his Qaul.net use, without a measured outcome. The X migration changed both transport and encoding, and Khavel_dev's integer-field result is an anecdote. None supplies a performance guarantee for a new application.
Historical issues also leave current platform questions open. In #644, asuuma patched basic Unity use and zeroZshadow reported success in Unity 5.2.2f and WebGL, while the discussion also describes an iOS Reflection.Emit restriction. In #1594, commenters report merged JRuby packaging patches and a Java-platform gem built from master, rather than confirmed publication of the corrected official package. #6632 discusses C# nullable annotations and #3431 discusses Span-based parsing; their closure is not proof of a released solution to every request.
We have not validated a Python packaging remedy, interoperable decimal or UUID conversions, secure allocation behavior, or unknown-field preservation across an older intermediary and storage. The historical unknown-field discussion does not establish today's behavior in every runtime. The primary protobuf.js README explicitly describes its own unknown-field defaults and retention options, which is another reason to make that check implementation-specific. Before committing a service interface, send one new field through the oldest reader you still support and check what returns.


