Post

Benchmarking JSON vs Protobuf vs Avro for Internal APIs

As internal microservices grew, so did our payload sizes. I benchmarked JSON, Protobuf, and Avro using realistic data models and the results were telling:

FormatSize ReductionParse Speed Gain
JSONBaselineBaseline
Protobuf~65% smaller3-4x faster
Avro~50% smaller2.5x faster

TL;DR: JSON remains king for readability and clients, but Protobuf dominated internal APIs for performance.

Here’s a quick Java-based benchmark using JMH:

1
2
3
4
5
@Benchmark
public void parseWithProtobuf() {
    MyProto.parseFrom(byteArray);
}

Outcome: We standardized on Protobuf for service-to-service traffic and retained JSON for edge APIs.

This post is licensed under CC BY 4.0 by the author.