News for hackers. Stuff that matters.
Re:Post-REST by rb808 on Monday November 19, 2018 @12:37PM (#18488069)
The article is named Post-REST, but the summary says: "...REST still pro­vides a good clean way to de­com­pose com­pli­cat­ed prob­lem­s, and its ex­treme sim­plic­i­ty and re­silience..."

Is there a reason not to use REST then? I didn't quite understand.

Re:Post-REST by kh_hk on Monday November 19, 2018 @01:17PM (#18488403)
Yes and no. Should you keep using HTTP calls for adding an item to a cart? Possibly. Should you use HTTP calls to communicate between services, let's say, to poll a resource every second and know if a worker has finished, when there are better systems and there's good enough technology available to support a higher throughput? Not so much.
Re:Post-REST by dragonwriter on Monday November 19, 2018 @04:42PM (#18489980)
> Should you use HTTP calls to communicate between services

Yes, it's mostly fine for that. Not always ideal, sure.

> let's say, to poll a resource every second and know if a worker has finished

No, you generally shouldn't poll every second. You should POST a subscription and then the other end should POST you a notification.

If you are in a situation where you need to poll instead of subscribing and waiting, then, maybe use HTTP long polling, maybe poll less frequently than every second, maybe use something other than HTTP, but in any case you are in a suboptimal circumstance.

(Of course, whether you should use HTTP as a transport protocol is orthogonal to whether or not you should use a REST architectural style.)

Re:Post-REST by icebraining on Monday November 19, 2018 @01:27PM (#18488478)
Polling every second would be wasteful; you can just make an HTTP request and hold the connection open until it's finished. Or just pass an URL, and let the other side call you.

(That's assuming HTTP, which btw is not the only protocol which can implement REST constraints)

Re:Post-REST by kh_hk on Monday November 19, 2018 @01:36PM (#18488562)
Then you are dealing with client timeouts or the fact that a lot of endpoints do not support url callbacks (for good reasons) or maybe clients that cannot be called back (for good reasons too).

Cannot say much about REST constraints outside of HTTP so excuse my ignorance on that. But I think it was clear the parent was referring to HTTP, or most possibly, GET and POST HTTP calls returning JSON.

Re:Post-REST by icebraining on Monday November 19, 2018 @03:48PM (#18489641)
You always have to deal with timeouts and other network issues, regardless of protocol.

Rather than retry every second, you retry on timeout.

Re:Post-REST by kh_hk on Monday November 19, 2018 @04:32PM (#18489927)
And yet most HTTP APIs are going to give you a response with an status instead of holding it. I guess because it's much easier to implement and also assumes less on the consumer part. Then there was Comet and what resulted from that, websockets and server side events.
Re:Post-REST by bduerst on Monday November 19, 2018 @01:30PM (#18488504)
So in summary - HTTP calls for front-end, but not back-end to back-end services?
Re:Post-REST by lotyrin on Monday November 19, 2018 @01:54PM (#18488717)
Not exactly.

Transactional CRUD (post a form, submit an email, add to cart) is pretty well adopted and standardized as HTTP, so probably use that (even backend to backend, if the contract fits CRUD resource semantics).

RPC (non-CRUD interactions) or streaming updates (e.g. a spinner in a app representing a pending job) or low latency (chat messages / presence status, etc.) don't really fit to HTTP requests so great (requiring e.g. polling) so you should look at alternatives (probably something proxied over a websocket in the case of a browser front-end app).

Re:Post-REST by kh_hk on Monday November 19, 2018 @01:51PM (#18488689)
I wouldn't be super quick on drawing the front-end and back-end distinction. A front facing interface using sockets could (depending on how flexible we are with terminology of course) be considered front-end too. And I think that's the entire point of the article.

I have seen huge benefits, performance being one, communicating using ZMQ (at the cost of complexity and reliability). A worker, running on your computer, consuming data fed through a socket from a broker, running on your server.

Re:Post-REST by jimbokun on Monday November 19, 2018 @04:43PM (#18489990)
After reading the article, the combination of REST APIs combined with durable, persistent queues (Kafka), covers most architectural needs. Queues for managing internal low latency and high throughput use cases. REST for external facing APIs with good documentation and well defined semantics.
Re:Post-REST by umvi on Monday November 19, 2018 @01:10PM (#18488337)
> Is there a reason not to use REST then? I didn't quite understand

There can be. For example in the world of satellite internet where every byte is precious and every tcp connection is a massive performance penalty (3 way handshake * distance to satellite at speed of light = huge latencies), a REST API can be very wasteful. Something like GraphQL is much more suited to that case where you can get only exactly what you need, nothing more, and on a single connection.

Re:Post-REST by icebraining on Monday November 19, 2018 @01:21PM (#18488423)
Nothing in REST prevents you from asking and getting only what you need. Assuming you're using HTTP, that's a common use of URL parameters; alternatively, you can pass a more detailed request in the body (yes, even in GET).
Re:Post-REST by dragonwriter on Monday November 19, 2018 @01:29PM (#18488490)
> Nothing in REST prevents you from asking and getting only what you need. Assuming you're using HTTP, that's a common use of URL parameters; alternatively, you can pass a more detailed request in the body (yes, even in GET).

GET is specified as not having a body and conformant HTTP implementations ignore the body of a GET, so in addition to violating RESTs general proscription on violating the underlying protocol (HTTP, in this example), you break compatibility with standard toolchain components if you do this.

What you seem to want is SEARCH pulled out from under the weight of WebDAV, i.e.: https://tools.ietf.org/html/draft-snell-search-method-01

Re:Post-REST by umvi on Monday November 19, 2018 @01:30PM (#18488501)
Right but... you're basically suggesting I implement a query language into my REST backend. Why would I do that if a similar QL already exists in the form of GraphQL?
Re:Post-REST by ako on Monday November 19, 2018 @03:11PM (#18489363)
Or use oData which is a REST query language.