Get to know RPC, Why was it born RPC, and HTTP What's the difference ？
- What is? RPC？
- Why RPC, What problem to solve ？
- RPC And HTTP What's the difference ？
- You know how many RPC？
RPC：Remote Procedure Call, Remote procedure call . It means that the computer program makes the process in different address space （ Usually on another computer on a shared network ） Execution time , It's encoded like normal （ Local ） Procedure call , Without the programmer explicitly coding the details for remote interaction .
RPC It's a kind of server - client （Client/Server） Pattern , The classic implementation is a way to do it through Send a request - Accept the response A system for information exchange .
RPC Is interprocess communication （IPC） A form of , Because different processes have different address spaces ： If it's on the same host , Even if the physical address space is the same , They also have different virtual address spaces ; If they're on different hosts , The physical address space is different . Many different （ It's usually incompatible ） Technology has been used to implement this concept .
【 Simple understanding 】： Two different computers （ Program ）,
Computer A There is one Agreement ,
Computer B Want to call
Computer A Need to pass through Agreement To make a communication call .
RPC The birth of
In fact as early as 1982 About years ago RPC It's used by people to communicate with distributed systems , The earliest invention 『 Remote procedure call 』 The person who uses this word is 『 Bruce · jay · Nielsen (Bruce Jay Nelson)』 About it. 1981 year .
We're familiar with Java stay 1.1 Version provides Java Version of RPC frame （RMI）, At this time in 1990 After year , Basically RPC It is widely used in system to system calls . But only in the back end , For the public, more contact is still needed HTTP Such agreement , Therefore RPC Let the public know more about cognition later .
RPC And HTTP
Let's start with HTTP
HTTP：Hypertext Transfer Protocol Hypertext transfer protocol .
HTTP The agreement 1990 It only began to appear as a mainstream agreement in 1997 ; The reason why they are known to us , Because usually HTTP be used for web End , That is to say web The browser and web Server interaction . When ajax and json When the front end is popular ,json And it's starting to play its part , Simplicity and ease of use make json Become the mainstream choice of front and back end data transmission .HTTP In the agreement Restful Specification as representative , It has a lot of advantages . it Good readability , And You can get Firewall support 、 Cross language support .
HTTP The shortcomings of the new technology are soon exposed ：
- Less useful information ,HTTP stay OSI The seventh floor , It contains a lot of HTTP First class information
- Low efficiency , Because of the seventh floor , There are a lot of layers in the middle
- HTTP agreement Calling remote methods is complicated , Need to encapsulate various parameter names and parameter values, as well as encrypted communication, etc
therefore RPC Good news ？
- It's all useful information
- Easy to call
- No need to care about network transmission or communication
HTTP and RPC There's a connection
http It's also rpc A way of doing it .
RPC and HTTP In a word, it's different
RPC It's like a regional dialect , Only the inside knows , Both sides need to know the dialect , Otherwise, we can't communicate
HTTP It's Putonghua , Basically understand , I can also say
RPC It's usually used for ？
stay Microservices 、 Distributed It has become the everyday today , Services are usually deployed on different servers , The servers are also in different regions , At this time, there is a cross region and cross server call problem ,RPC That is to say, it can be used in similar situations .
RPC For internal use of the company , Low performance consumption , High transmission efficiency , Service governance is convenient , But it's not recommended to transfer large text 、 Video etc. .
Questions at the end of the passage
- Does it make you understand HTTP and RPC Some of them are different ？
- RPC What do you want to do with it ？
- You're using RPC Do you ？