🚀 Day 4 of 10: Designing Data-Intensive Applications
Software is constantly changing. New features ship. Business rules evolve. Schemas must change.
But in distributed systems, code cannot update everywhere at the same time.
During rolling upgrades, old and new versions of your application run side by side. If your data encoding is not designed for this, you get downtime or data loss.
Here’s what Chapter 4 of *Designing Data-Intensive Applications* teaches:
### 1. Two Representations of Data - In-memory: Objects, structs, pointers — optimized for the CPU - On the wire / on disk: Byte sequences — self-contained and portable
Moving between them is called encoding (serialization) and decoding (deserialization).
Textual formats (JSON, XML, CSV) - Human-readable and widely supported - But: ambiguous numbers, no native binary, and very verbose
Binary schema-driven formats (Protocol Buffers, Thrift, Avro) - Much smaller and faster - Use field tags or schema resolution instead of repeating field names
Key differences: - Protobuf & Thrift → use numeric field tags. You can rename fields freely, but never change a tag number. - Avro → no field tags at all. Decoding works by comparing the writer’s schema with the reader’s schema. Perfect for dynamically generated schemas.
Best practices: 1. Never change existing field tags 2. Only add optional fields (or fields with defaults) 3. Always preserve unknown fields when reading → modifying → writing data
There are three main patterns:
Evolvability is not optional in distributed systems. Choose schema-driven binary encodings, enforce strict backward + forward compatibility, and design your data flow so that old and new code can coexist peacefully.
Tomorrow (Day 5) we dive into Replication — how to keep data copies consistent across machines.
Drop a 🔥 if this helped. Comment “schema” if you’ve ever broken production with a schema change.
Who’s currently dealing with schema evolution pain? Let’s discuss.
#SystemDesign #SchemaEvolution #ProtocolBuffers #Avro #DistributedSystems #DesigningDataIntensiveApplications