In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 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 difference between RPC and Restful". 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's the difference between RPC and Restful".
In micro-services, what protocol to use to build the service system has always been a hot topic. The focus of the debate is on two candidate technologies: RPC or Restful
RPC:Remote Produce Call remote procedure calls, as well as RMI. Custom data format, based on native TCP communication, fast and efficient. The early webservice, and now the popular Dubbo, are typical representatives of RPC.
Http:http is actually a network transmission protocol, which defines the format of data transmission based on TCP. At present, the communication between client browser and server basically adopts Http protocol, and it can also be used for remote service invocation. The disadvantage is that the message encapsulation is bloated, and the advantage is that there are no technical restrictions on the service provider and caller, free and flexible, and more in line with the concept of micro-service.
0x01:RPC
RPC is remote procedure call (Remote Procedure Call Protocol, referred to as RPC), which invokes the server's service (method) like a local service (method). The common implementations are XML-RPC and JSON-RPC, which communicate in the same way, except for the format in which the data is transmitted.
The main goal of the RPC framework is to make remote service invocation simpler and more transparent. 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.
0x02:Restful
REST, or Representational State Transfer (REST for short), is a style of software architecture. REST uniquely identifies network resources with URI through the general verb methods defined by HTTP protocol (GET, PUT, DELETE, POST). According to the different needs of the requestor, the responder expresses the requested resources through stateless communication. The architecture that meets the constraints and principles of REST is called RESTful architecture.
0x03: differences between
The difference between using RPC remote service invocation and traditional http interface direct invocation is that:
From the point of view of usage, the Http interface only cares about the service provider (server) and does not care about how and how the client invokes it. In general, when the client invokes using Http, it only needs to transfer the content, so the client needs to pay more attention to the network transmission when using it, which is not suitable for business development. On the other hand, RPC service requires that the client interface is consistent with the server, the server provides a method, the client initiates the call directly through the interface, and the business developer only needs to pay attention to the call of the business method, no longer pay attention to the details of network transmission, and is more efficient in development.
From a performance point of view, when using Http, Http itself provides rich state functions and extended functions, but it is precisely because of the excessive functions provided by Http that it needs to carry more information when it is transmitted over the network, which is relatively inefficient from a performance point of view. On the other hand, the RPC service network only transmits the data related to the business content, so the transmission data is smaller and the performance is higher.
From the point of view of operation and maintenance, when using the Http interface, a front-end proxy is often used to forward proxy requests for Http. When capacity expansion is needed, it is necessary to modify the configuration of the proxy server, which is tedious and error-prone. For micro-services based on RPC, as long as a service node is added, the registry can automatically sense the changes of the node and notify the calling client to dynamically control the load, which is more intelligent and saves the operation of operation and maintenance.
Thank you for your reading, the above is the content of "what's the difference between RPC and Restful?" after the study of this article, I believe you have a deeper understanding of the difference between RPC and Restful, 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.
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.