gRPC and Protocol Buffers



I’m not a programmer, but would like to understand this as my coworkers use it a lot and talk about it a lot.

In: Technology

gRPC is Google’s Remote Procedure Call protocol. RPC is used to give commands to other computers. Things like “Add this product to order #5”, or “tell me the price of this product”.

Protocol Buffers is a way to encode arbitrary data to send to another machine. Encoding data is one of those annoying things that must be done frequently, but is easy to get wrong. Let’s say you want to send the information about an user. An improvised version might be something like:

# Name, password, account type
Dale Glass, adfaf, admin

But if you think of it that’s an awful format. It’s not very extensible, you can only append stuff to the end, and commas are meaningful. If somebody manages to get a comma into their name or password, things go horribly wrong. And what if you want to add a new data item that itself is a list of elements? Or even stores hierarchical information? Things start to get messy.

Things like protocol buffers solve this problem of encoding data in a way that’s fast, compact, avoids known thorny issues, and isn’t inconvenient to code.