News for hackers. Stuff that matters.
Re:It's TCP vs. RPC All over Again by manv1 on Tuesday February 21, 2023 @08:04PM (#34890095)
This paragraph is just wrong:

"Another explanation is that the Internet has unnecessarily coupled the transport protocol with the rest of the RPC framework. Conflating the two naturally follows from the purpose-built examples I just gave: SMTP is bundled with MIME; SNMP is bundled with MIB; and HTTP is bundled with HTML. "

I think at this point he's suffering from what old-timers used to call recto-cranial inversion.

Re:It's TCP vs. RPC All over Again by codeflo on Tuesday February 21, 2023 @08:15PM (#34890198)
I think I feel dumber for reading this. (The referenced paper by Ousterhout is quite good though, and doesn’t confuse the terminology. Maybe that one’s what HN should link and discuss.)
Re:It's TCP vs. RPC All over Again by matjet on Wednesday February 22, 2023 @12:37AM (#34892048)
To someone only weakly aware in this area, can you explain what is wrong with the statement? From a cursory view, these protocols indeed seem to normally carry the mentioned payloads.
Re:It's TCP vs. RPC All over Again by lozenge on Wednesday February 22, 2023 @04:44AM (#34893558)
It's not like HTTP stops working if you choose to send something besides HTML. Most of its features still work and make sense for JSON payloads and the usual building blocks still work (eg HTTPS, load balancers, proxies, status codes, redirects...)

There are a few bits that don't make sense eg cookies where the server sends something and the client is expected to remember it but they can just be ignored.

Re:It's TCP vs. RPC All over Again by codeflo on Wednesday February 22, 2023 @05:33AM (#34893872)
Exactly. The HTTP standard doesn't really mention HTML, except tangentially in examples. And regarding cookies, there are even people who use cookies in RPC contexts, but this is rather rare, and as you said, entirely optional.

Also, as a minor point, even when browsing the web, a minority of the actual requests deliver HTML -- most of them are for various kinds of media referenced by the HTML document.

Re:It's TCP vs. RPC All over Again by cryptonector on Wednesday February 22, 2023 @12:43AM (#34892076)
Agreed. MIME came after SMTP, for example, and HTTP is used for all sorts of not-HTML-or-hyper-anything stuff. That statement smacks me of "wow, HTTP is a pretty good RPC, but too bad it's only/mainly for transporting HTML, shucks!". The name of the protocol is not very representative anymore either of how it's used or how anyone should use it. If HTTP fits the bill, then use it and move on.
Re:It's TCP vs. RPC All over Again by derefr on Wednesday February 22, 2023 @02:38AM (#34892786)
And I keep saying that SMTP is a perfectly good message-queue broker message submission protocol (and POP a perfectly good message-queue broker:consumer protocol), but nobody ever listens. :P
Re:It's TCP vs. RPC All over Again by tleilaxu on Wednesday February 22, 2023 @03:27AM (#34893080)
I listened, derefr. I listened. ;)
Re:It's TCP vs. RPC All over Again by vidarh on Wednesday February 22, 2023 @07:13AM (#34894460)
I've not jus tused SMTP the protocol as a submission protocol, but used actual mail servers as the broker, in a production system.

Back in '99 I co-founded a mail provider, and we got so used to abusing qmail (+ rewritten replacement components - any qmail installation becomes a Ship of Theseus thanks to the clear API between small components) that when we needed a message broker we used our internal DNS server for service discovery and our mail infra as the broker (and we had a DNS server where the zones could be updated via SMTP). It worked well, and let us reuse a lot of tooling.

Re:It's TCP vs. RPC All over Again by derefr on Wednesday February 22, 2023 @12:09PM (#34898795)
> and we had a DNS server where the zones could be updated via SMTP

Interesting — what was the message format (MIME type) you chose to use to describe the zone changes? Actually, were they even patch-files at all, or did you just fetch the zone data file from your DNS server, update it client-side, and then send an updated complete copy back in the body of the email message, to get de-enveloped directly into /var/named?

With the benefit of hindsight, I'm guessing you'd agree that it would have been simpler to use an LDAP directory for service discovery; then you'd at least have a specced-out message format for updates (LDIF) to be sending to the queue. But then, OpenLDAP as a project only got started in 1998, so maybe you weren't even aware of its existence back then, and were stuck on YP/NIS for Intranet directory management (which has no similar useful extensibility.)

Re:It's TCP vs. RPC All over Again by cryptonector on Wednesday February 22, 2023 @01:42PM (#34900538)
In hindsight everything should be HTTP, and there should be JSON schemas as an option for everything. Not needing the bloat of an LDAP implementation is very nice. Schema differences between sites and schema metastasis into code in ways that complicate schema evolution is a big deal too, so "stored procedures" are really a good idea for containing schema metastasis.

I'm not sure why GP would need service discovery for DNS zone updates via SMTP though.

Re:It's TCP vs. RPC All over Again by vidarh on Wednesday February 22, 2023 @02:45PM (#34901542)
Mail servers have a bunch of tooling for routing, retries, queue management etc. that already exists. If you do that via HTTP you end up having to reinvent a full message broker stack just for the sake of using a different protocol that lacks the abundance of components you can just drop in to do things like reflection (mailing lists), forwarding, filtering, retrieval, deletion, access control that you get for free with a mail server.

Maybe if we that entire ecosystem existed on top of HTTP it'd have been ok, but the actual transport is the tiniest little uninteresting sliver of what we got by using a mail server for queuing.

With respect to the DNS servers, the service discovery was for addressing, so we/a client component could e.g. e-mail "[email protected]" or similar. The SMTP updated one was not the service discovery one, but feeding our customer facing DNS infrastructure.

Re:It's TCP vs. RPC All over Again by cryptonector on Wednesday February 22, 2023 @03:57PM (#34902608)
There's several ways of doing service discovery for HTTP services like this in an enterprise, using 3xx replies to redirect if you move the service. The simplest is to just use a URI authority that you can change as needed. The next simplest is to publish URI RRs in DNS. The next simplest is to use the .well-known URI local-part namespace to include information for client-side routing. Granted, the last two are recent developments.
Re:It's TCP vs. RPC All over Again by vidarh on Wednesday February 22, 2023 @05:21PM (#34903800)
Or we could just use DNS A or CNAME records and not have to do any of those, the way e.g. CoreDNS w/k8s or ldapdns on top of openldap, and similar does.

There are use cases for more complicated service discovery, especially discovery of external services, but for the scenario I described, which in involved discovery within our own network this all just would have added extra complexity for no benefit that would have made any difference to us.

Note that service discovery was not listed as one of the reasons I think http doesn't solve the issues that made us choose a mail server back then..the exact same service discovery mechanism would have worked just fine for http too. But we'd still have had to build all the message broker code from scratch instead of picking and choosing from pre-existing components.

Re:It's TCP vs. RPC All over Again by cryptonector on Wednesday February 22, 2023 @05:52PM (#34904198)
I'm not saying that you shouldn't have used SMTP. It really is appropriate for this sort of thing. If you wanted an HTTP interface you might still make it inject messages into SMTP, with HTTP being only used for a browser UI, say, or with the HTTP server as a proxy for some reason.

My objection had been to LDAP. LDAP is too heavy-weight by comparison to HTTP w/ a JSON API.

Re:It's TCP vs. RPC All over Again by vidarh on Wednesday February 22, 2023 @02:28PM (#34901274)
The DNS for service discovery was fairly static, and not what we updated via SMTP.

We treated the DNS server in question simply as a key-value store where a message would set/replace a specific record. The use case was that we we're setting a handful of records when people registered a domain, so those DNS servers were user visible, unlike the service discovery.

The main reason for not considering LDAP at the time for the user facing DNS server besides the lack of maturity for OpenLDAP was that using SMTP gave us one single unified mechanism for dispatching messages to all parts of the system, which also meant it was trivial to proxy, intercept, and log the full message flow with the same mechanism as needed.

Re:It's TCP vs. RPC All over Again by derefr on Wednesday February 22, 2023 @09:37PM (#34906008)
To be clear, I'm not saying you should have used LDAP as a changeset submission protocol instead of SMTP; I'm saying you should have used LDIF as a changeset format for sending via SMTP, instead of inventing your own changeset description format to send over SMTP. :)

> We treated the DNS server in question simply as a key-value store where a message would set/replace a specific record.

Interesting! That doesn't sound like any DNS server I'm aware of. In BIND et al, a zone was a file, and to update a zone you needed to modify a zone file and SIGHUP the daemon; which in turn meant that whatever you were using to mechanistically modify zones, needed to be able to parse and regenerate an entire zone file at a time. (It's actually a lot like what's required to mechanistically update-patch Kubernetes YAML resource manifests, now that I think about it.)

Or do you mean that you had exactly one record per zone in this key-value store? If so, how did that work exactly? Zones need at least an SOA record, no? Or, I guess, maybe not, if this nameserver was only exposed within the Intranet, without the requirement of being an authoritative source that other DNS servers could fetch and cache from.

Re:It's TCP vs. RPC All over Again by vidarh on Thursday February 23, 2023 @01:48AM (#34907584)
The DNS server was our own.

Writing an authoritative-only DNS server is trivial (few hundred lines), and since it knew it was always authoritative, it'd synthesise a SOA record for every zone it answered for.

The zones had a very minimal set of records: Either they had NS records pointing to where the user wanted the domain delegated, or to us. If they pointed to us they had an A and MX record which might point to us or to wherever the customer wanted.

It was not exposed only within the intranet (the service discovery DNS was exposed only via the internet; separate thing)

Re:It's TCP vs. RPC All over Again by denton-scratch on Wednesday February 22, 2023 @04:59AM (#34893657)
MIME not only arrived after SMTP (the 'E' in MIME stands for 'extension'); it doesn't infect the SMTP part of the stack. There's nothing in SMTP that would have to change if MIME was abolished. SMTP provides no special support for MIME. They are disjoint.

Since HTTP/1.1, HTTP hasn't been premised on HTML, and vice-versa; again they are disjoint.

I don't know why author makes these claims.

Re:It's TCP vs. RPC All over Again by drpixie on Wednesday February 22, 2023 @06:05AM (#34894066)
HTTP might now be used for other things but right from the beginning (check the RFCs) HTTP stood for "Hypertext Transfer Protocol", the RFC was written by Berners-Lee. HTTP and HTML did come together, and from the same person.
Re:It's TCP vs. RPC All over Again by josephg on Wednesday February 22, 2023 @06:36AM (#34894255)
So? They aren’t bundled together as the article says they are. Even on the web HTTP is used for all sorts of other content types, from images to CSS, loading javascript, JSON RPC calls, websocket connections, server sent events and so on. Outside of the web? DoH, JSON RPC, git over https, npm, video games, elasticsearch queries, … the list goes on for a long time.

A very small percent of http requests transmit html.

Claiming http “bundles” html is like saying XmlHttpRequest is bundled with xml, or shortening javascript to Java. It’s a strong signal that you don’t know what you’re talking about.

Re:It's TCP vs. RPC All over Again by 0x445442 on Wednesday February 22, 2023 @08:32AM (#34895131)
The HTTP verbs don’t support RPC unless you violate their specified operations. Add DO to GET, PUT, POST, PATCH and DELETE along with expanded response codes and I’m good.
Re:It's TCP vs. RPC All over Again by remram on Wednesday February 22, 2023 @09:39AM (#34896234)
Why not use POST?
Re:It's TCP vs. RPC All over Again by cryptonector on Wednesday February 22, 2023 @10:56AM (#34897568)
You can add verbs.
Re:It's TCP vs. RPC All over Again by toast0 on Wednesday February 22, 2023 @11:58AM (#34898566)
All those verbs are just constants that provide some behavior.

POST is the constant that means I'm going to probably send you a body and probably nobody is going to try to add caching, which is usually what you want from an RPC. You can just #define DO POST, and you're set.

Re:It's TCP vs. RPC All over Again by cryptonector on Wednesday February 22, 2023 @01:35PM (#34900418)
And POST can come with a response body. And it can either create a new entity or not. It's what you want for an RPC, yes. That's why SOAP used it. Of course, it's not "RESTful", but hey.
Re:It's TCP vs. RPC All over Again by remram on Wednesday February 22, 2023 @03:15PM (#34901965)
RPC usually means stateful client so REST goes out the window.
Re:It's TCP vs. RPC All over Again by cryptonector on Wednesday February 22, 2023 @04:06PM (#34902740)
Browser clients of RESTful APIs can be stateless in a very stateful way because the DOM and JS allows the client to keep state. The statelessness of HTTP is supposed to be about the HTTP layer itself, not the application, and this is true as much about the client as about the server.

Consider a database application where the client is a browser and the server is just something like PostgREST, and then you see that the client stores state impliedly in the DOM (what rows it's displaying, which affects what the user might do next) and that the server keeps state in the database even though PostgREST itself is stateless. The whole thing is RESTful (because REST is in the name of PostgREST, duh; just kidding, it really is).

I think this RPC-means-stateful / REST-means-stateless dichotomy is just not quite right, and it leads to thinking like that in TFA. All RESTful really means is that you use appropriate HTTP verbs for the actions you're doing (especially HEAD and GET for reading so you can cache where caching makes sense), use HTTP status codes as much as possible, and give entities URIs (possibly derived on the fly) -- that's really it. If you have an RPC called `CreateWidgetyThing()` you can just as well have a POST to `/widgety-things` to create them -- it really is that simple.