Search code examples
protocol-buffersgrpcgo-micro

Difference between go-micro and go-grpc


I have constructed a "go-micro" service. From what I understand, go-micro uses protobuf to define and create the messages structures & used gRPC as the network protocol (I of course might be wrong here).

If the above it correct, than what does the plug-in "go-grpc" is being used for?

Thanks!


Solution

  • Let me have a try.

    RPC is just a method invocation model, as long as we can call a remote service from local, we can say that is some type of RPC.

    RPC comes in different flavors, as client and service can communicate in different protocols, like UDP, TCP, HTTP, HTTP/2.

    Protobuf, like JSON, XML, is just data exchange format, except json and xml is text-based while protobuf is byte-based and saves lots of bandwidth and serialization time.

    So put together, we can combine these two to form all sorts of RPC. For example, sending JSON data via UDP is one form of RPC, sending XML data via TCP is another, sending Protobuf data via UDP is yet another one.

    GRPC is one form of RPC that sends Protobuf data via HTTP/2 protocol.

    go-micro is a microservices framework, services communicate via RPC, so go-micro offer developers all sorts of RPCs to choose from, and they come in the form of Plugins, like UDP, HTTP, GRPC, etc.

    GRPC is a communication model, and can be implemented in most languages like C++, JAVA, Go. Thus Go-GRPC is a GRPC plugin written in go language.

    Hope I explained it clearly, and correct me if I am wrong,