network-programmingprotocol-buffersgrpc

protobuf vs gRPC


I try to understand protobuf and gRPC and how I can use both. Could you help me understand the following:

I already know - or assume I do - that:

Protobuf

gRPC

I again assume its an easy question for someone already using the technology. I still would thank you to be patient with me and help me out. I would also be really thankful for any network deep dive of the technologies.


Solution

  • Protocol buffers is (are?) an Interface Definition Language and serialization library:

    gRPC uses the same IDL but adds syntax "rpc" which lets you define Remote Procedure Call method signatures using the Protobuf data structures as data types:

    In answer to the questions:

    1. gRPC works at layers 5, 6 and 7. Protobuf works at layer 6.
    2. When you say "message transfer", Protobuf is not concerned with the transfer itself. It only works at either end of any data transfer, turning bytes into objects
    3. Using gRPC by default means you are using Protobuf. You could write your own client that uses Protobuf but not gRPC to interoperate with gRPC, or plugin other serializers to gRPC - but using gRPC would be easier
    4. True
    5. Yes you can