Using Protocol Buffers in Microservices
Using Protocol Buffers in Microservices

Using Protocol Buffers in Microservices

Author
Shiv Bade
Tags
protobuf
serialization
Published
January 8, 2018
Featured
Slug
Tweet
JSON is great for human readability, but once you’re exchanging high volumes of messages between internal services, its verbosity becomes a real issue.
That’s where Protocol Buffers (Protobuf) come in. Around this time, I started replacing JSON with Protobuf in our gRPC-based services. The results were significant — payload sizes dropped by over 60% and response times improved.
Sample .proto file:
syntax = "proto3"; message Product { string id = 1; string name = 2; float price = 3; }
Using it in Java was simple with Maven plugins. One thing I learned early — versioning matters. Backward compatibility isn’t a given unless you respect field numbering rules.
Overall, Protobuf has been an excellent fit for internal communication, while we still serve JSON externally.