Reputation: 95
I recently found out that RPC and REST are just API constructs and not different protocols through which two services communicate and send data to each other over the network. The underlying protocol is still HTTP in both the cases.
The question which came to my mind was - How did services used to communicate before the advent of RPC?
This might be very trivial, but I am just trying to understand some differences between REST, RPC, HTTP and trying to have clear concepts
Upvotes: 0
Views: 34
Reputation: 2813
HTTP is a protocol for transmission of data. It was originally developed for browsers to request hypertext (HTML) data from a web server, but can also be used for requesting and returning other content such as a JSON data structure.
This is what typical REST systems do: They use HTTP as a protocol and JSON as a data format for transmission. However, note that REST does not require you to use a specific protocol or data format. So if you talk about REST, you do not talk about a protocol, but rather about a design concept - you think in terms of resources (such as database entities) that you access on a remote system.
RPC is another technique for communication in distributed systems (and not a protocol either). In contrast to REST, you think in terms of procedures or functions that you call on a remote system. RPC is the older approach and there are again several protocols for implementing RPC-based systems, which may be based on HTTP or something else.
There are other and even older methods for transmitting data between different processes or systems, for example using shared memory or sharing files between a sender and a receiver (see inter-process communication for an overview).
Upvotes: 0
Reputation: 57307
I recently found out that RPC and REST are just API constructs and not different protocols through which two services communicate and send data to each other over the network. The underlying protocol is still HTTP in both the cases.
If you want to understand Remote Procedure Calls, then a reasonable starting point is Bruce Jay Nelson's 1981 dissertation. (Note that this precedes HTTP by 10 years, and REST by 15 to 19 years, depending on when you start from).
If you want to understand REST, then a reasonable starting point is chapter 5 of Roy T. Fielding's 2000 dissertation
If you want to get an understanding of why some HTTP API design is categorized as RPC rather than REST, a reasonable starting point would be Fielding's 2008 rant REST APIs must be hypertext-driven.
How did services used to communicate before the advent of RPC?
This question may be backwards - I'm not sure we even had "services" before we had RPC.
Upvotes: 0