In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
What is the difference between RPC services and HTTP services, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.
1. What is RPC
RPC (Remote Procedure Call)-remote procedure call, which is a protocol that requests services from remote computer programs over the network without knowing the underlying network technology. The RPC protocol assumes the existence of certain transport protocols, such as TCP or UDP, to carry information data between communication programs. In the OSI network communication model, RPC spans the transport layer and the application layer. RPC makes it easier to develop applications, including web-based distributed multiprograms.
RPC uses the client / server (cplink s) mode. The requester is a client and the service provider is a server. First, the client invocation process sends a call message with process parameters to the service process, and then waits for the reply message. On the server side, the process stays asleep until the call message arrives. When a call message arrives, the server obtains the process parameters, calculates the result, sends the reply message, and then waits for the next call message. Finally, the client invokes the process to receive the reply message, obtains the process result, and then calls execution to proceed.
2. OSI network seven-layer model.
Before talking about the difference between RPC and HTTP, I think it is necessary to understand the seven-layer network structure model of OSI, which can be divided into the following layers (bottom-up):
The first layer: physical layer. This layer is mainly used to transmit these binary data.
The second layer: link layer. Encapsulate the packets of the above network layer into data frames to facilitate physical layer transmission
The third layer: the network layer. Define how data is transferred between network devices
The fourth layer: the transport layer. Manages end-to-end data transmission in the network
The fifth layer: the conversation layer. Manage user sessions and control the establishment and interruption of logical connections between users
The sixth layer: the presentation layer. Define the transmission format, encoding and decoding specifications of data in different systems
The seventh layer: application layer. Defines the interface for communicating and transmitting data in the network
3. RPC call process
In a nutshell, a complete RPC architecture contains four core components, namely Client, Server,Client Stub, and Server Stub
1. Client (RPC Client): service caller
2. Client Client Stub: store the server address information, package the client request parameters into a network message, and then send it to the server through the network.
3. Server Server Stub: accept the message sent by the client and unpack it, and then call the local service
4. RPC Server: the real service provider.
RPC adopts C _ pact S mode, in which the requester is a client application and the service provider is a server. First, the service consumer (RPC client application) invokes the process to send a call message with process parameters to the service process, and then waits for the reply message. At the service provider (RPC server side), the process remains asleep until the invocation message arrives. When a call information arrives, the server obtains the process parameters, calls the server method to calculate the call request and gets the calculation result, sends the reply message, and then waits for the next call message; finally, the client invokes the process to receive the reply message, obtains the process result, and then calls execution to continue.
4. The function of RPC architecture
The main goal of RPC is to make it easier and transparent to build distributed computing (applications) without losing the semantic simplicity of local calls while providing strong remote invocation capabilities. To achieve this goal, the RPC framework needs to provide a transparent invocation mechanism so that consumers do not have to explicitly distinguish between local and remote calls. The RPC framework is responsible for shielding the underlying transport mode (TCP or UDP), serialization mode (XML/JSON/ binary), and communication details. When using it, developers only need to know who provides what remote service interface in what location, and do not need to care about the underlying communication details and invocation process.
5. Common RPC technologies and frameworks
(1) Application-level service framework: Dubbo/Dubbox, Google GRPC, Spring Boot/Spring Cloud of Ali.
(2) remote communication protocols: RMI, Socket, SOAP (HTTP XML), REST (HTTP JSON).
(3) Communication framework: MINA and Netty
6. HTTP service VS RPC service
Transport protocol
RPC, which can be based on TCP protocol or HTTP protocol
HTTP, based on HTTP protocol
Transmission efficiency
RPC, using the custom TCP protocol, can make the request message smaller, or using HTTP2 protocol, it can also reduce the packet size and improve the transmission efficiency.
HTTP, if it is based on HTTP1.1 protocol, the request will contain a lot of useless content. If it is based on HTTP2.0, then the following simple encapsulation can be used as a RPC. At this time, the standard RPC framework is more about service governance.
Performance consumption, mainly due to the time-consuming serialization and deserialization
RPC, which can achieve efficient binary transmission based on thrift
HTTP, mostly implemented through json, consumes more performance than thrift in terms of byte size and serialization time
Load balancing
RPC, basically comes with its own load balancing strategy.
HTTP, which needs to be configured with Nginx,HAProxy to implement
Service governance (downstream services are added, restarted, and how upstream callers are not affected when they go offline)
RPC, which can notify automatically without affecting upstream.
HTTP, prior notice is required to modify the Nginx/HAProxy configuration
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.