Live data from Hacker News

It's TCP vs. RPC All over Again

systemsapproach.substack.com

41–50 of 116 posts

Re: It's TCP vs. RPC All over Again

#41

You could just use UDP instead of TCP and implement some subset of TCP features that you need in-band, like sequence numbers. This is not a new concept. The Facebook Memcache paper [1] in 2013 described using UDP for intra-datacenter requests. [1] https://research.facebook.com/publications/scaling-memcache-...

Sure, but what is UDP bringing to the party then? The pseudoheader?

A reasonable RPC layer could just layer on IP.

Re: It's TCP vs. RPC All over Again

#42
post #4

Good to learn a bit of history about TCP. It always felt weird developing RPC layers on top of TCP cause requests and responses end up tied to the underlying socket -- which doesn't need to be the case ever.

How else would the kernel know to which application it should route a response?

Destination port number should be sufficient.

For example, imagine if there are two sockets established between server and client processes (due to multiple ips or roaming, time lags, etc.), then in theory, request received from one socket could be responded through another socket. From application pov it doesn't need to care about the socket. We can do this over TCP, but connection-oriented nature of TCP makes this weird.

Re: It's TCP vs. RPC All over Again

#43
post #41

You could just use UDP instead of TCP and implement some subset of TCP features that you need in-band, like sequence numbers. This is not a new concept. The Facebook Memcache paper [1] in 2013 described using UDP for intra-datacenter requests. [1] https://research.facebook.com/publications/scaling-memcache-...

Sure, but what is UDP bringing to the party then? The pseudoheader? A reasonable RPC layer could just layer on IP.

IIRC, UDP just adds port numbers and a checksum to IP. It's about as bare bones as it can get, unless you want to get rid of the checksum too.

Re: It's TCP vs. RPC All over Again

#44
post #41

You could just use UDP instead of TCP and implement some subset of TCP features that you need in-band, like sequence numbers. This is not a new concept. The Facebook Memcache paper [1] in 2013 described using UDP for intra-datacenter requests. [1] https://research.facebook.com/publications/scaling-memcache-...

Sure, but what is UDP bringing to the party then? The pseudoheader? A reasonable RPC layer could just layer on IP.

The UDP header will give you proper ECMP hashing.

Re: It's TCP vs. RPC All over Again

#45
post #35
post #30

There have been lots of RPC protocols. Here are some still in use. Transport level: * Sun RPC [1]. QNX still uses this. It can run over UDP or over raw Ethernet. It just transfers an array of bytes and gets an array of bytes back - marshalling is a higher level problem. It handles messages bigger than one packet, and retransmission. It's simple and performance is good, but there is no security. * Stream Control Trans…

Yeah, but the question at hand is why layer it over TCP. SunRPC over UDP is close, but then you push reliability and congestion management into every application.

SCTP, from the parent's list, is a "over IP" protocol, not over TCP.

(Though it can be tunneled through UDP, to get around Internet ossification.)

Re: It's TCP vs. RPC All over Again

#46
post #30

There have been lots of RPC protocols. Here are some still in use. Transport level: * Sun RPC [1]. QNX still uses this. It can run over UDP or over raw Ethernet. It just transfers an array of bytes and gets an array of bytes back - marshalling is a higher level problem. It handles messages bigger than one packet, and retransmission. It's simple and performance is good, but there is no security. * Stream Control Trans…

> CORBA - you define interfaces in a special language and compile them. Data is not self-describing.

OMG the Common Object Request Broker Architecture (which coincidentally was created by OMG). I never thought I'd see that acronym again, and all these years later, I still don't understand what it is.

Re: It's TCP vs. RPC All over Again

#47
post #6

Really interesting article. Wish there was a discussion of performance for various RPCs from the past.

RPC in general failed for two reasons: 1. Synchronous in an async environment 2. Brittle client/server coupling of RPC definitions

HTTP is a remote procedure call, it's request/response.

Each request/response pair is independent and asynchronous.

The difference between HTTP and a more "specified" RPC is that the body of the request and the body of the response are defined "out of band" and are flexible enough to allow for the client and the server to evolve independently.

I could make HTTP look like ONC-RPC by using XDR to martial the arguments in the request/response body and map the actual procedure name to the URL. The MIME type "application/protobuf" exists to do the same using protobufs. So does "applicaton/vnd.google.protobuf".

HTTP was built using TCP as the reliable connection layer over the IP packet protocol but QUIC replaces that using UDP over IP to remove the problems that a connection based/reliable protcol like TCP causes.

Really not sure what a new protocol would provide other than shuffling the boundaries again.

Re: It's TCP vs. RPC All over Again

#48
post #24

Earlier quoted context omitted.

Do you mean the `select` call? libuv and friends can offer higher throughput than `select`.

It’s been many many years since I’ve done low level multiplexing but I think epoll() is the no longer quite so new hotness? Ah I see libuv is a cross platform lib. I’d probably use that for production code, but it’s still really valuable to work with the low level API enough to understand it.

Yeah epoll is what libuv calls on Linux. And agreed I think it's very valuable to try and use epoll or equivalent yourself at least once to understand what's happening.

Re: It's TCP vs. RPC All over Again

#49
post #25

Earlier quoted context omitted.

Do you mean the `select` call? libuv and friends can offer higher throughput than `select`.

Whatever OS primitive this API effectively calls is what I use: https://learn.microsoft.com/en-us/dotnet/api/system.net.sock... Edit: This is the source: https://source.dot.net/#System.Net.Sockets/System/Net/Socket...

I didn't dive past the links you dropped, but reading the doc comment makes it seem like the call is using `poll` (as an alternative to `select` for FD size reasons.) It's well recognized that the polling model of `select` and `poll` are slow and it was specifically this problem that led to the framing of the C10K problem. The solution is to use an async style of programming which is what libuv and other wrappers offer (piggybacking off `epoll` on Linux.)

Re: It's TCP vs. RPC All over Again

#50
post #41

You could just use UDP instead of TCP and implement some subset of TCP features that you need in-band, like sequence numbers. This is not a new concept. The Facebook Memcache paper [1] in 2013 described using UDP for intra-datacenter requests. [1] https://research.facebook.com/publications/scaling-memcache-...

Sure, but what is UDP bringing to the party then? The pseudoheader? A reasonable RPC layer could just layer on IP.

> Sure, but what is UDP bringing to the party then?

Interoperability. It's been how many years since SCTP was published? How's that going?

Post reply on HN