2

I have a quick question about RPC vs HTTP.

I have figured out, that the main difference between RPC and HTTP is, that you call a function on a Server (RPC) and that HTTP is for exchanging Data.

But they are quite similar right? When you Post something or Get something (HTTP), the server is also just doing functionality with the data you did send to it.

I have read, that HTTP uses TCP and RPC UDP. Can someone explain that to me? Why does HTTP need TCP? The difference between TCP and UDP is clear to me, but why do they both use different technologies, when they are actually doing the same thing?

So where is the difference between them?

Julian Reschke
  • 40,156
  • 8
  • 95
  • 98

1 Answers1

2

RPC just means Remote Procedure Call, i.e. invoking some functionality offered by a remote "thing" (process, computer, ...) and maybe getting a result back. It does not mean a specific technology how these RPC are done.

There is actually a variety of technologies to do this, see Wikipedia: RPC for more. Some of these technologies use HTTP as the underlying layer. Some use UDP, most probably use TCP though.

So basically you are comparing "food delivery" (RPC) with "car" (HTTP), i.e. food can be delivered using cars but not all cars deliver foods and not all food delivery is done by car.

Steffen Ullrich
  • 114,247
  • 10
  • 131
  • 172
  • Thanks for your comment, I totally understand that. So RPC can run on HTTP 2, HTTP 3, TCP, it doesn't matter, right? What are the advantages/disadvantages for running RPC over TCP compared to HTTP? – Henrik Mader Jun 22 '21 at 10:55
  • @HenrikMader: *"What are the advantages/disadvantages for running RPC over TCP compared to HTTP?"* - There is no single kind of RPC over HTTP. There is no single kind of RPC over TCP. Also, HTTP is usually a protocol on top of TCP which makes everything over HTTP also implicitly something over TCP. Comparing all the different RPC technologies possible over TCP and HTTP is too broad. – Steffen Ullrich Jun 22 '21 at 11:44