Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the concept of RPC

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "what is the concept of RPC". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the concept of RPC".

I. the concept of RPC

Dubbo service is a RPC framework, so we must first understand what is called RPC, Remote Procedure Call is remote procedure call.

A remote procedure call is relative to a local procedure call, which, needless to say, is simply understood as a local method calling a function. A remote call is a procedure or function that calls another address space (usually on another machine that shares the network). Without the programmer explicitly coding the details of the remote call. That is, programmers write basically the same calling code, whether they call local or remote functions.

The basic architectural diagram of RPC is as follows:

The RPC framework is the client stub and server stub in the figure. To call each other between services, you need to establish a connection. When the client calls client stub, it may need to pass parameters, but when it is passed between networks, it needs to be serialized. After serialization is complete, the message that needs to be invoked will be sent to server stub. After receiving the information, the server first deserializes, and then invokes the local service. After invoking the local service, the processing result is returned. The result also needs to be serialized. After serialization is completed, the message is returned, and client stub receives the message. You also need to deserialize again and convert it to the result of the call, which is a complete RPC process, as shown in the figure:

The RPC framework is to implement things like that helper, to make remote calls as simple and convenient as local calls, and to solve some of the problems that can occur in remote calls, which are imperceptible to us.

We can also see in the sample diagram that the core module of RPC is communication and serialization.

So if we were to design a RPC framework, what would our design idea be like?

First of all, start from the service caller, this is a consumer, we want to consume a service, then this service should be in the form of an interface, this interface is generally defined by a public jar package, when I know what interface to call, the specific implementation does not need to be clear, these should be done by the framework proxy, I only need to take the interface and parameters.

Consumers do not need to know the details and do not need to know which server to call the service. At this time, there should be a registration center, which is somewhat similar to the front desk property of the company building. He is responsible for guiding guests to find the company that resides in this building. Each company is a similar service provider. After the company enters the building, it will tell the receptionist its floor and house number. The front desk posted the company's situation on the front desk guide, so when someone wants to find the company to provide services, they can directly find the company they want to go to, and after the company moves out, the front desk property will remove the company. The server that consumers need can find the corresponding company directly.

Of course, if you directly tell the customer your specific location, then the customer does not need to go to the registry to find you, that is, the registry can not be needed.

As a service provider, you have to tell others about the server your company can provide, implement the corresponding interface, and then expose it, that is, register yourself with the registry and expose the services you can provide. Then there is a consumer request that needs to be processed, and the provider needs to process the request with a negotiated agreement with the consumer, and then deserialize it.

In the face of many services, meticulous monitoring and convenient operation and maintenance are essential. At this time, we need to monitor the operation and maintenance, that is, the monitoring center. Of course, if you want to be so reckless, you don't need monitoring, and of course you can.

At this point, this is the architecture we can think of, so let's take a look at the dubbo design (of course, I pushed it back through the actual architecture, manual dog head).

II. The core concepts of Dubbo

Dubbo is a Java-based RPC framework that Alibaba opened up in 2011, but it has been quiet for some time, but some other enterprises are still using Dubbo and extending it themselves, such as Dangdang's Dubbox and NetEcola's Dubbok.

It merged with Dubbox in 2018, entered the Apache incubator and officially became a top-level Apache project in 2019.

Learn a technology, if there is an official website, we try to learn from the official website: first of all, we need to know what the features of Dubbo are:

High-performance RPC invocation oriented to interface proxy: provides high-performance proxy-based remote invocation capability. The service takes the interface as the granularity, shielding the underlying details of remote invocation for developers.

Intelligent load balancing: built-in a variety of load balancing strategies, intelligently perceive the health status of downstream nodes, significantly reduce call latency and improve system throughput.

Automatic registration and discovery of services: support a variety of registry services, real-time awareness of service instances online and offline.

Highly scalable: follow the design principles of microkernel + plug-ins, all core competencies such as Protocol, Transport, Ser.

Thank you for your reading, the above is the content of "what is the concept of RPC", after the study of this article, I believe you have a deeper understanding of what the concept of RPC is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report