Skip to main content
PreparationZone Logo
PrepZone

Avro, Protobuf, and JSON Trade-offs

Pick serialization for VaultCommerce events — schema evolution, payload size, and human debuggability.

Pass checkpoint below

Why this matters

  • JSON cost VaultCommerce 3× storage and 40% higher network vs Avro on order topics.
  • Protobuf excels for gRPC services already on protobuf; Avro fits Kafka ecosystem better.
  • Schema Registry requires Confluent wire format — plan deserializer config accordingly.
  • Format choice is hard to change — pick once per topic family.
ApplicationVaultCommerce OrderService
Serializer
Record batch
Broker leader
Serializer → partitioner → record batch → broker leader. Callback fires with RecordMetadata or error.

Format comparison

JSON: human-readable, no schema enforcement, large payloads. Avro: compact, excellent Schema Registry integration, requires schema at read time. Protobuf: compact, strong typing, good for polyglot. VaultCommerce uses Avro for domain events, JSON for debug/admin topics only.

Key points

  • Avro — schema-in-payload-header via registry ID; compact binary
  • Protobuf — Google format; schema via proto file + optional registry
  • JSON Serializer — no schema enforcement; use only for low-volume debug
  • Confluent wire format — magic byte + schema ID prefix
  • SpecificRecord vs GenericRecord — generated Java classes vs dynamic maps

The rest of this guide is part of Pro

Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.

Still to come · 2 sections

  • Wire format and headers
  • VaultCommerce rollout checklist

Test yourself

Answer these before moving on — recall is what makes it stick.