Перейти к содержимому

Protobuf vs JSON: When Is a Schema Worth It?

Learning Podcasts

0:00 / 0:00

Protobuf vs JSON: When Is a Schema Worth It?

83 просмотра · 1 месяц назад
Learning Podcasts
5,59 тыс. подписчиков
83 просмотра · 1 месяц назад
Protobuf versus JSON is usually framed as binary speed against readable text. That misses the decision that matters: how much coordination pressure exists at the boundary, and which contract is worth operating? This chapter compares three real choices: raw JSON, JSON governed by JSON Schema or OpenAPI, and binary Protobuf with its schema, compiler, generated APIs, and runtimes. Then it applies six questions to two fictional cases: a partner-facing HTTP API and a long-lived internal event consumed by independently deployed systems. The examples are fictional composites. No company architecture, outage, benchmark, fleet size, or performance result is claimed. Performance is treated as something to measure on the real workload after the contract and operational fit are understood. Built from public docs, papers, talks, and code, then vetted by senior software engineers for correctness, tradeoffs, and production risks. The core references are the official Protobuf, JSON, JSON Schema, and OpenAPI specifications and documentation, linked below. Sources: Protocol Buffers Overview: https://protobuf.dev/overview/ Protocol Buffers Encoding Guide: https://protobuf.dev/programming-guid... Protocol Buffers ProtoJSON Format: https://protobuf.dev/programming-guid... Protocol Buffers History: https://protobuf.dev/history/ RFC 8259, The JavaScript Object Notation Data Interchange Format: https://www.rfc-editor.org/rfc/rfc825... JSON Schema Specification: https://json-schema.org/specification JSON Schema, The Architectural Scope of JSON Schema: https://json-schema.org/blog/posts/th... OpenAPI Specification 3.2.0: https://spec.openapis.org/oas/v3.2.0.... Chapters: 00:00 One Payload, Three Contracts 01:07 Binary vs Text Is the Wrong Axis 01:57 What Raw JSON Guarantees 02:56 JSON Can Have a Real Contract 04:11 What Protobuf Bundles 05:13 Developer Contracts Came Second 06:04 The Hidden Costs on Both Sides 07:18 Case 1: Partner API 08:23 Case 2: Internal Event 09:37 A Hybrid Architecture 10:19 ProtoJSON Isn't an Escape Hatch 11:17 Performance Is Question 6 12:07 The Six-Question Checklist Full series playlist (12 chapters):    • Protobuf for Any Software Engineer   1. Protobuf Ch.1: Schema and Serialization:    • Protobuf Ch.1: Schema and Serialization   2. Protobuf Ch.2: Writing Proto Files:    • Protobuf Ch.2: Writing Proto Files   3. Protobuf Ch.3: Code Generation:    • Protobuf Ch.3: Code Generation   4. Protobuf Ch.4: 87% Smaller Than JSON:    • Protobuf is 87% Smaller Than JSON!   5. Protobuf Maps Are Just Repeated Messages:    • Protobuf Maps Are Just Repeated Messages   6. Protobuf Ch.6: Optional Is Just a Synthetic Oneof:    • Protobuf Optional Is Just a Synthetic Oneof   7. Protobuf: Zero, False, Empty, or Missing?:    • Protobuf: Zero, False, Empty, or Missing?   8. Protobuf: Stop Inventing Timestamp Formats:    • Protobuf: Stop Inventing Timestamp Formats   9. Change Protobuf Schemas Without Breaking Production:    • Change Protobuf Schemas Without Breaking P...   10. Protobuf vs JSON: When Is a Schema Worth It? (this video):    • Protobuf vs JSON: When Is a Schema Worth It?   11. Protobuf Services: API Contracts Beyond Messages 12. Common Protobuf Mistakes That Break Compatibility Subscribe to catch every chapter.