Chapter 3. What are Protocol Buffers?
gRPC focuses on optimizing three layers of the OSI model:
- Application (HTTP2)
- Presentation (Protobuf)
- Session (RPC)
We’ll explain every layer of optimization throughout this book, but now it is time to take a deep dive into Protobuf or Protocol Buffers. One of the biggest concerns when it comes to REST/JSON micro-service architectures is the “I couldn’t care less” attitude about bandwidth. The whole JSON message is sent among clients and servers in a plain text form, and its payload becomes repetitive and sometimes unnecessary.
JSON APIs are widely adopted by many developers because they are easy to read and debug, and JSON is implemented natively in many languages, such as NodeJS. For early projects, which need to go fast and have the Firsts prototypes up and running in a very short time, a JSON API can be recommended. But problems can arise. JSON messages are supposed to evolve, but client and server source code can...