Remote Process Call (RPC) is a core part of Dubo-Go and other service governance frameworks. With the popularity of Internet products today, the single architecture gradually cannot bear the increasing pressure of requests, so it is necessary to split the single service.

In the split process, a monolithic system is broken up into services. The original calls between local methods, when split, become microservices architecture, become calls between services. Can calls between services be as silky as calls between local methods? This is the problem RPC needs to solve.

So, the problem RPC solves is getting callers to use RPC like using local method callsThe sameSimple.

If you want to understand how RPC works, you need to know the problem each module solves, which is a core part of Dubbo-Go and other service governance frameworks. Therefore, this module will focus on dubbo-Go RPC, and this lecture will take how to master Dubbo-Go RPC as the core, take you to understand what is RPC, DUbbo-Go RPC process and the role of each module, from the whole to the local analysis.

Next, to understand how RPC works in Dubo-Go, you need to know what RPC is. It is necessary to have a full understanding of the problem or process to be solved as a whole. Based on the overall understanding, it is better to learn the implementation of dubbo-Go RPC with some problems that are not understood in details, thus deepening the understanding of DUbbo-Go RPC.

What is the RPC

Before combing RPC processes, understand what RPC is. Through the local procedure call and RPC two examples to analyze the difference between them, first look at the local call code:

`func main() {` `j := &Joe{}` `j.say(` `}` `type Person interface {` `say()` `}` `type Joe struct {` `}` `func (j *Joe) say() {` `fmt.Println("hello world!" ) ` ` `}Copy the code

 

The above example calls the person.say () method in a program and makes the method call through the function pointer to the structure, called a local procedure call.

Figure 1: Remote procedure call

Remote procedure call is different. The method implementation is placed on the server side. The client calls the local interface method, and the RPC framework serializes and sends the necessary parameters, such as method name and input parameters, to the server side. Server-side RPC framework, deserialize and make method calls, process, serialize and return results. The client deserializes and outputs. In short, the key to understanding RPC is to let callers use RPC as easily as using local method calls.

So how does Dubo-Go make calling remote methods as easy as calling local methods? The following articles will cover the entire RPC flow of Dubo-Go.

Welcome to the community

Pay attention to the public account [minister technology road], in the public account background reply keyword [dubbogo] to join the community.