当前位置:网站首页>Talk about the understanding of RPC
Talk about the understanding of RPC
2022-08-11 02:56:00 【C'z x】
What is RPC?
PRC is a remote procedure call, a protocol for requesting services from a remote computer program over a network without requiring knowledge of the underlying network technology.For example, two different services A and B are deployed on two different machines. What if service A wants to call a method in service B?It's certainly possible to use HTTP requests, but it may be more cumbersome.RPC came into existence to make calling remote methods as easy as calling local methods.
RPC principle
The service consumer (client) calls the service in the local call mode;
The client stub is responsible for assembling methods, parameters, etc. into a message body that can be transmitted over the network after receiving the call;
The client stub finds the service address and sends the message to the server;
The server stub decodes the message after receiving it;
The server stub calls the local service according to the decoding result;
The local service executes and returns the result to the server stub;
The server stub packs the returned result into a message and sends it to the consumer;
The client stub receives the message and decodes it;
The service consumer gets the final result.
Already have http protocol interface, why use RPC technology?
It is indeed a wise choice to use http when there are not many interfaces. For example, in a start-up company, we are not sure that the business can be carried out smoothly, and may face bankruptcy at any time, and there are not enough developers. At this time, it is simple and efficient to usetechnology, it is the wisest choice to make things first, and there is no need to go to the sky in one step.
In the case of less interaction between the system and the system, the advantages of using the http protocol are obvious: the development is simple, the testing is relatively straightforward, and the deployment is convenient, and the off-the-shelf http protocol is used for inter-system communication.It is also slowly expanding, and the benefits of the RPC framework are shown.
First of all, RPC supports long links, and communication does not have to repeat 3 handshakes every time like http, which reduces network overhead.
Secondly, the RPC framework generally has a registration center module with complete monitoring and management functions. Service registration and discovery, service offline, and service dynamic expansion are all easy to operate, and the efficiency of service-based governance is greatly improved.
RPC based on TCP protocol can customize protocol fields more flexibly. Compared with http, it can reduce the number of network transmission bytes, reduce network overhead (handshake) and improve performance.Achieving greater throughput and concurrency, but requires more attention to the underlying complex details, high requirements for developers, and increased development costs.
边栏推荐
- 行业的思考
- 正式发布丨VS Code 1.70
- Google search skills - programmer is recommended
- ①In-depth analysis of CAS SSO single sign-on framework source code
- Oops novice template Framework project guide
- AI+医疗:使用神经网络进行医学影像识别分析
- 21 Day Learning Challenge Week 1 Summary
- Salesforce disbands the Chinese team, which CRM product is more suitable for the Chinese
- CC0 与商业 IP:哪种模式更适合 NFT?
- 入职数字ic设计后的一些工作心得
猜你喜欢
DOM树的遍历-----修改样式,选择元素,创建和删除节点
经典面试题 之 GC垃圾收集器
①CAS SSO单点登录框架源码深度分析
正式发布丨VS Code 1.70
ARM development (4) How to read the chip manual for novice Xiaobai, bare metal driver development steps and pure assembly to achieve lighting, assembly combined with c lighting, c to achieve lighting
alibaba数据同步组件canal的实践整理
八.数据的存储
①In-depth analysis of CAS SSO single sign-on framework source code
关于地图GIS的一次实践整理(下) Redis的GIS实践
qtcreator调试webkit
随机推荐
[机缘参悟-66]:怎样才能让别人愿意帮你:利益共享法则、“大道”、“人性”
Summary of Logstash log data write exception troubleshooting
混币器Tornado遭制裁 对DeFi市场意味着什么?
BUU brushing record
“京台高铁”亮相百度地图,真能在2035年建成吗?
gRPC闭包调度器
The ifconfig compared with IP command
MySQL - an SQL in MySQL is how to be performed?
BUU刷题记录
comp3331-9331-16s2-midterm复习
Idea (优选)cherry-pick操作
Mysql_Note5
ES6进阶 字符串处理新特性
21 Day Learning Challenge Week 1 Summary
Economic Misunderstandings in the Crypto World: Is Cash a Savings?Scarcity creates value?
代码 Revert 后再次 Merge 会丢失的问题,已解决
夫妻一方婚内向异性大额转款,怎么判
Goodbye Chengdu paper invoices!The issuance of electronic invoices for accommodation expenses will soon completely replace the invoices of hotels, catering and gas stations
调试技巧总结
小幻美图 API